1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
test_description='Check content on index page'
. ./setup.sh
test_expect_success 'generate index page' 'cgit_url "" >tmp'
test_expect_success 'find foo repo' 'grep "foo" tmp'
test_expect_success 'find foo description' 'grep "\[no description\]" tmp'
test_expect_success 'find bar repo' 'grep "bar" tmp'
test_expect_success 'find bar description' 'grep "the bar repo" tmp'
test_expect_success 'find foo+bar repo' 'grep ">foo+bar<" tmp'
test_expect_success 'verify foo+bar links' 'test $(grep -o "href=./foo%2Bbar/." tmp | wc -l) = 2'
test_expect_success 'verify "with%20space" links' 'test $(grep -o "href=./with%20space/." tmp | wc -l) = 2'
test_expect_success 'no tree-link' '! grep "foo/tree" tmp'
test_expect_success 'no log-link' '! grep "foo/log" tmp'
test_expect_success 'index links lead to the summary, log and tree' '
echo "enable-index-links=1" >links-cgitrc &&
sed "s/^cache-size=.*/cache-size=0/" cgitrc >>links-cgitrc &&
CGIT_CONFIG="$PWD/links-cgitrc" QUERY_STRING="url=" cgit >tmp &&
grep ">summary</a><a class=.button. href=./foo/log/.>log</a>" tmp &&
grep "href=./foo/log/.>log</a><a class=.button. href=./foo/tree/.>tree<" tmp
'
test_expect_success 'each css and js entry gets a link of its own' '
{
echo "css=/a.css" &&
echo "css=/b.css" &&
echo "js=/a.js" &&
echo "js=" &&
echo "js=/b.js"
} >headrc &&
sed "s/^cache-size=.*/cache-size=0/" cgitrc >>headrc &&
CGIT_CONFIG="$PWD/headrc" QUERY_STRING="url=" cgit >tmp &&
grep "<link rel=.stylesheet. href=./a.css.>" tmp &&
grep "<link rel=.stylesheet. href=./b.css.>" tmp &&
grep "<script src=" tmp >scripts &&
test_line_count = 2 scripts &&
grep "/a.js" scripts &&
grep "/b.js" scripts
'
test_expect_success 'the feed link encodes the repository and the branch' '
sed "s/^cache-size=.*/cache-size=0/" cgitrc >feedrc &&
CGIT_CONFIG="$PWD/feedrc" HTTP_HOST=example.org QUERY_STRING="url=foo%2Bbar/log/&h=1%2B2" cgit >tmp &&
grep "title=.Atom feed. href=.http://example.org/foo%2Bbar/atom/?h=1%2B2." tmp
'
test_expect_success 'a cut description keeps whole characters' '
{
echo "max-repodesc-length=10" &&
sed "s/^cache-size=.*/cache-size=0/" cgitrc &&
echo "repo.url=mb" &&
echo "repo.path=$PWD/repos/foo/.git" &&
echo "repo.desc=日本語の説明文です"
} >descrc &&
CGIT_CONFIG="$PWD/descrc" QUERY_STRING="url=" cgit >tmp &&
grep ">日本語\.\.\.</a>" tmp
'
test_done
|