Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | . ./setup.sh |
| 4 | |
| 5 | prepare_tests "Check content on commit page" |
| 6 | |
| 7 | run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp' |
John Keeping | 392e07d | 2013-03-04 21:58:49 +0000 | [diff] [blame] | 8 | run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp' |
Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 9 | run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp' |
| 10 | |
| 11 | run_test 'find commit subject' ' |
John Keeping | 392e07d | 2013-03-04 21:58:49 +0000 | [diff] [blame] | 12 | grep "<div class=.commit-subject.>commit 5<" trash/tmp |
Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 13 | ' |
| 14 | |
John Keeping | 392e07d | 2013-03-04 21:58:49 +0000 | [diff] [blame] | 15 | run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp' |
| 16 | run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/tmp' |
Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 17 | |
| 18 | run_test 'find diff summary' ' |
John Keeping | f9b801a | 2013-03-04 21:58:50 +0000 | [diff] [blame] | 19 | grep "1 files changed, 1 insertions, 0 deletions" trash/tmp |
Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 20 | ' |
| 21 | |
Lars Hjemli | 502d575 | 2008-05-18 21:09:26 +0200 | [diff] [blame] | 22 | run_test 'get root commit' ' |
John Keeping | f9b801a | 2013-03-04 21:58:50 +0000 | [diff] [blame] | 23 | root=$(cd trash/repos/foo && git rev-list --reverse HEAD | head -1) && |
| 24 | cgit_url "foo/commit&id=$root" >trash/tmp && |
| 25 | grep "</html>" trash/tmp |
Lars Hjemli | 502d575 | 2008-05-18 21:09:26 +0200 | [diff] [blame] | 26 | ' |
| 27 | |
| 28 | run_test 'root commit contains diffstat' ' |
John Keeping | f9b801a | 2013-03-04 21:58:50 +0000 | [diff] [blame] | 29 | grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" trash/tmp |
Lars Hjemli | 502d575 | 2008-05-18 21:09:26 +0200 | [diff] [blame] | 30 | ' |
| 31 | |
| 32 | run_test 'root commit contains diff' ' |
John Keeping | f9b801a | 2013-03-04 21:58:50 +0000 | [diff] [blame] | 33 | grep ">diff --git a/file-1 b/file-1<" trash/tmp && |
| 34 | grep "<div class=.add.>+1</div>" trash/tmp |
Lars Hjemli | 502d575 | 2008-05-18 21:09:26 +0200 | [diff] [blame] | 35 | ' |
| 36 | |
Lars Hjemli | b4649fc | 2007-11-11 00:40:58 +0100 | [diff] [blame] | 37 | tests_done |