all repos — cgit @ eb80b4edadd07957f667f057c82875c30a822a1f

a hyperfast web frontend for git written in c

tests/t0105-commit.sh (view raw)

 1#!/bin/sh
 2
 3test_description='Check content on commit page'
 4. ./setup.sh
 5
 6test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >tmp'
 7test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" tmp'
 8test_expect_success 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" tmp'
 9
10test_expect_success 'find commit subject' '
11	grep "<div class=.commit-subject.>commit 5<" tmp
12'
13
14test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp'
15test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp'
16
17test_expect_success 'find diff summary' '
18	grep "1 files changed, 1 insertions, 0 deletions" tmp
19'
20
21test_expect_success 'get root commit' '
22	root=$(cd repos/foo && git rev-list --reverse HEAD | head -1) &&
23	cgit_url "foo/commit&id=$root" >tmp &&
24	grep "</html>" tmp
25'
26
27test_expect_success 'root commit contains diffstat' '
28	grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp
29'
30
31test_expect_success 'root commit contains diff' '
32	grep ">diff --git a/file-1 b/file-1<" tmp &&
33	grep "<div class=.add.>+1</div>" tmp
34'
35
36test_done