2007-11-10 23:40:58 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_description='Check content on commit page'
|
2007-11-10 23:40:58 +00:00
|
|
|
. ./setup.sh
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >tmp'
|
|
|
|
test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" tmp'
|
|
|
|
test_expect_success 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" tmp'
|
2007-11-10 23:40:58 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'find commit subject' '
|
|
|
|
grep "<div class=.commit-subject.>commit 5<" tmp
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp'
|
|
|
|
test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp'
|
2007-11-10 23:40:58 +00:00
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'find diff summary' '
|
|
|
|
grep "1 files changed, 1 insertions, 0 deletions" tmp
|
2007-11-10 23:40:58 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'get root commit' '
|
|
|
|
root=$(cd repos/foo && git rev-list --reverse HEAD | head -1) &&
|
|
|
|
cgit_url "foo/commit&id=$root" >tmp &&
|
|
|
|
grep "</html>" tmp
|
2008-05-18 19:09:26 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'root commit contains diffstat' '
|
2020-10-20 21:46:09 +00:00
|
|
|
grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40,64\}.>file-1</a>" tmp
|
2008-05-18 19:09:26 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_expect_success 'root commit contains diff' '
|
|
|
|
grep ">diff --git a/file-1 b/file-1<" tmp &&
|
|
|
|
grep "<div class=.add.>+1</div>" tmp
|
2008-05-18 19:09:26 +00:00
|
|
|
'
|
|
|
|
|
2013-04-01 14:09:05 +00:00
|
|
|
test_done
|