about summary refs log tree commit diff stats
path: root/tests/t0104-tree.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/t0104-tree.sh
parentDo not load user or system gitconfig and gitattributes (diff)
downloadcgit-c95cc5ec56dbb7394015eb18201403be6d80f69b.tar.gz
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/t0104-tree.sh')
-rwxr-xr-xtests/t0104-tree.sh33
1 files changed, 16 insertions, 17 deletions
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 7aa3b8d..100b026 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh
@@ -1,33 +1,32 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test_description='Check content on tree page'
3. ./setup.sh 4. ./setup.sh
4 5
5prepare_tests "Check content on tree page" 6test_expect_success 'generate bar/tree' 'cgit_url "bar/tree" >tmp'
7test_expect_success 'find file-1' 'grep "file-1" tmp'
8test_expect_success 'find file-50' 'grep "file-50" tmp'
6 9
7run_test 'generate bar/tree' 'cgit_url "bar/tree" >trash/tmp' 10test_expect_success 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >tmp'
8run_test 'find file-1' 'grep "file-1" trash/tmp'
9run_test 'find file-50' 'grep "file-50" trash/tmp'
10 11
11run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' 12test_expect_success 'find line 1' '
12 13 grep "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" tmp
13run_test 'find line 1' '
14 grep "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp
15' 14'
16 15
17run_test 'no line 2' ' 16test_expect_success 'no line 2' '
18 ! grep "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp 17 ! grep "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" tmp
19' 18'
20 19
21run_test 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >trash/tmp' 20test_expect_success 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >tmp'
22 21
23run_test 'verify a+b link' ' 22test_expect_success 'verify a+b link' '
24 grep "/foo+bar/tree/a+b" trash/tmp 23 grep "/foo+bar/tree/a+b" tmp
25' 24'
26 25
27run_test 'generate foo+bar/tree?h=1+2' 'cgit_url "foo%2bbar/tree&h=1%2b2" >trash/tmp' 26test_expect_success 'generate foo+bar/tree?h=1+2' 'cgit_url "foo%2bbar/tree&h=1%2b2" >tmp'
28 27
29run_test 'verify a+b?h=1+2 link' ' 28test_expect_success 'verify a+b?h=1+2 link' '
30 grep "/foo+bar/tree/a+b?h=1%2b2" trash/tmp 29 grep "/foo+bar/tree/a+b?h=1%2b2" tmp
31' 30'
32 31
33tests_done 32test_done