2
0
mirror of https://git.zx2c4.com/cgit/ synced 2024-11-13 19:12:05 +00:00
cgit/tests/t0105-commit.sh
John Keeping c95cc5ec56 tests: use Git's test framework
This allows tests to run in parallel as well as letting us use "prove"
or another TAP harness to run the tests.

Git's test framework requires Git to be fully built before letting any
tests run, so add a new target to the top-level Makefile which builds
all of Git instead of just libgit.a and make the "test" target depend on
that.

Signed-off-by: John Keeping <john@keeping.me.uk>
2013-04-08 22:27:11 +02:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
test_description='Check content on commit page'
. ./setup.sh
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'
test_expect_success 'find commit subject' '
grep "<div class=.commit-subject.>commit 5<" tmp
'
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'
test_expect_success 'find diff summary' '
grep "1 files changed, 1 insertions, 0 deletions" tmp
'
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
'
test_expect_success 'root commit contains diffstat' '
grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp
'
test_expect_success 'root commit contains diff' '
grep ">diff --git a/file-1 b/file-1<" tmp &&
grep "<div class=.add.>+1</div>" tmp
'
test_done