blob: 31b554b241e2a0e58811cd13234139fe2f46760a [file] [log] [blame]
Lars Hjemlib4649fc2007-11-11 00:40:58 +01001#!/bin/sh
2
3. ./setup.sh
4
5prepare_tests "Check content on commit page"
6
7run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp'
John Keeping392e07d2013-03-04 21:58:49 +00008run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp'
Lars Hjemlib4649fc2007-11-11 00:40:58 +01009run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
10
11run_test 'find commit subject' '
John Keeping392e07d2013-03-04 21:58:49 +000012 grep "<div class=.commit-subject.>commit 5<" trash/tmp
Lars Hjemlib4649fc2007-11-11 00:40:58 +010013'
14
John Keeping392e07d2013-03-04 21:58:49 +000015run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp'
16run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/tmp'
Lars Hjemlib4649fc2007-11-11 00:40:58 +010017
18run_test 'find diff summary' '
John Keepingf9b801a2013-03-04 21:58:50 +000019 grep "1 files changed, 1 insertions, 0 deletions" trash/tmp
Lars Hjemlib4649fc2007-11-11 00:40:58 +010020'
21
Lars Hjemli502d5752008-05-18 21:09:26 +020022run_test 'get root commit' '
John Keepingf9b801a2013-03-04 21:58:50 +000023 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 Hjemli502d5752008-05-18 21:09:26 +020026'
27
28run_test 'root commit contains diffstat' '
John Keepingf9b801a2013-03-04 21:58:50 +000029 grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" trash/tmp
Lars Hjemli502d5752008-05-18 21:09:26 +020030'
31
32run_test 'root commit contains diff' '
John Keepingf9b801a2013-03-04 21:58:50 +000033 grep ">diff --git a/file-1 b/file-1<" trash/tmp &&
34 grep "<div class=.add.>+1</div>" trash/tmp
Lars Hjemli502d5752008-05-18 21:09:26 +020035'
36
Lars Hjemlib4649fc2007-11-11 00:40:58 +010037tests_done