diff options
author | John Keeping | 2013-04-01 15:09:05 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2013-04-08 22:27:11 +0200 |
commit | c95cc5ec56dbb7394015eb18201403be6d80f69b (patch) | |
tree | 7014b96a1a1408b5291532c0c442082aba693a80 /tests/t0105-commit.sh | |
parent | 8a92df033e974af6338b530a0d78d1bdb0b0f918 (diff) | |
download | cgit-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-x | tests/t0105-commit.sh | 41 |
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 | ||
3 | test_description='Check content on commit page' | ||
3 | . ./setup.sh | 4 | . ./setup.sh |
4 | 5 | ||
5 | prepare_tests "Check content on commit page" | 6 | test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >tmp' |
7 | test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" tmp' | ||
8 | test_expect_success 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" tmp' | ||
6 | 9 | ||
7 | run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp' | 10 | test_expect_success 'find commit subject' ' |
8 | run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp' | 11 | grep "<div class=.commit-subject.>commit 5<" tmp |
9 | run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp' | ||
10 | |||
11 | run_test 'find commit subject' ' | ||
12 | grep "<div class=.commit-subject.>commit 5<" trash/tmp | ||
13 | ' | 12 | ' |
14 | 13 | ||
15 | run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp' | 14 | test_expect_success 'find commit msg' 'grep "<div class=.commit-msg.></div>" tmp' |
16 | run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/tmp' | 15 | test_expect_success 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" tmp' |
17 | 16 | ||
18 | run_test 'find diff summary' ' | 17 | test_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 | ||
22 | run_test 'get root commit' ' | 21 | test_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 | ||
28 | run_test 'root commit contains diffstat' ' | 27 | test_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 | ||
32 | run_test 'root commit contains diff' ' | 31 | test_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 | ||
37 | tests_done | 36 | test_done |