diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0101-index.sh10
-rwxr-xr-xtests/t0303-robustness.sh6
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh
index b2ec813..adad6be 100755
--- a/tests/t0101-index.sh
+++ b/tests/t0101-index.sh
@@ -16,8 +16,8 @@ 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 link' 'grep "/foo+bar/" tmp'
-test_expect_success 'verify "with%20space" link' 'grep "/with%20space/" 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'
@@ -47,4 +47,10 @@ test_expect_success 'each css and js entry gets a link of its own' '
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_done
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index 888ca7f..2e0e849 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -639,6 +639,12 @@ test_expect_success 'the about redirect keeps the query string' '
grep "^Status: 200" tmp
'
+test_expect_success 'the about redirect encodes the repository url once' '
+ cgit_url "foo%2Bbar/about/" >tmp &&
+ grep "^Status: 302" tmp &&
+ grep "^Location: /foo%2Bbar/$" tmp
+'
+
# The about page shows the readme alone and its links lead into the tree,
# so a path below it names nothing, the site about page included.
test_expect_success 'a path below the about page answers 404' '