aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t0105-commit.sh
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-04-01 15:09:05 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2013-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 @@
#!/bin/sh
+test_description='Check content on commit page'
. ./setup.sh
-prepare_tests "Check content on commit page"
+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'
-run_test 'generate foo/commit' 'cgit_url "foo/commit" >trash/tmp'
-run_test 'find tree link' 'grep "<a href=./foo/tree/.>" trash/tmp'
-run_test 'find parent link' 'grep -E "<a href=./foo/commit/\?id=.+>" trash/tmp'
-
-run_test 'find commit subject' '
- grep "<div class=.commit-subject.>commit 5<" trash/tmp
+test_expect_success 'find commit subject' '
+ grep "<div class=.commit-subject.>commit 5<" tmp
'
-run_test 'find commit msg' 'grep "<div class=.commit-msg.></div>" trash/tmp'
-run_test 'find diffstat' 'grep "<table summary=.diffstat. class=.diffstat.>" trash/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'
-run_test 'find diff summary' '
- grep "1 files changed, 1 insertions, 0 deletions" trash/tmp
+test_expect_success 'find diff summary' '
+ grep "1 files changed, 1 insertions, 0 deletions" tmp
'
-run_test 'get root commit' '
- root=$(cd trash/repos/foo && git rev-list --reverse HEAD | head -1) &&
- cgit_url "foo/commit&id=$root" >trash/tmp &&
- grep "</html>" trash/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
'
-run_test 'root commit contains diffstat' '
- grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" trash/tmp
+test_expect_success 'root commit contains diffstat' '
+ grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" tmp
'
-run_test 'root commit contains diff' '
- grep ">diff --git a/file-1 b/file-1<" trash/tmp &&
- grep "<div class=.add.>+1</div>" trash/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
'
-tests_done
+test_done