aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t0105-commit.sh
diff options
context:
space:
mode:
authorJohn Keeping2013-04-01 15:09:05 +0100
committerJason A. Donenfeld2013-04-08 22:27:11 +0200
commitc95cc5ec56dbb7394015eb18201403be6d80f69b (patch)
tree7014b96a1a1408b5291532c0c442082aba693a80 /tests/t0105-commit.sh
parent8a92df033e974af6338b530a0d78d1bdb0b0f918 (diff)
downloadcgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.tar.gz
cgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.tar.bz2
cgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.zip
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>
Diffstat (limited to 'tests/t0105-commit.sh')
-rwxr-xr-xtests/t0105-commit.sh41
1 files changed, 20 insertions, 21 deletions
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 31b554b..9cdf55c 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -1,37 +1,36 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test_description='Check content on commit page'
3. ./setup.sh 4. ./setup.sh
4 5
5prepare_tests "Check content on commit page" 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'
6 9
7run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp' 10test_expect_success 'find commit subject' '
8run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp' 11 grep "<div class=.commit-subject.>commit 5<" tmp
9run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
10
11run_test 'find commit subject' '
12 grep "<div class=.commit-subject.>commit 5<" trash/tmp
13' 12'
14 13
15run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp' 14test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp'
16run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/tmp' 15test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp'
17 16
18run_test 'find diff summary' ' 17test_expect_success 'find diff summary' '
19 grep "1 files changed, 1 insertions, 0 deletions" trash/tmp 18 grep "1 files changed, 1 insertions, 0 deletions" tmp
20' 19'
21 20
22run_test 'get root commit' ' 21test_expect_success 'get root commit' '
23 root=$(cd trash/repos/foo && git rev-list --reverse HEAD | head -1) && 22 root=$(cd repos/foo && git rev-list --reverse HEAD | head -1) &&
24 cgit_url "foo/commit&id=$root" >trash/tmp && 23 cgit_url "foo/commit&id=$root" >tmp &&
25 grep "</html>" trash/tmp 24 grep "</html>" tmp
26' 25'
27 26
28run_test 'root commit contains diffstat' ' 27test_expect_success 'root commit contains diffstat' '
29 grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" trash/tmp 28 grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp
30' 29'
31 30
32run_test 'root commit contains diff' ' 31test_expect_success 'root commit contains diff' '
33 grep ">diff --git a/file-1 b/file-1<" trash/tmp && 32 grep ">diff --git a/file-1 b/file-1<" tmp &&
34 grep "<div class=.add.>+1</div>" trash/tmp 33 grep "<div class=.add.>+1</div>" tmp
35' 34'
36 35
37tests_done 36test_done