[PATCH 1/3] tests: document handling of repository names with spaces

John Keeping john at keeping.me.uk
Sun Mar 12 16:49:02 CET 2017


t0103-log.sh has a test to check that we don't properly escape spaces in
repository URLs, but no other tests do.

It turns out that the handling of this case in the index page is broken,
so mark this as test_expect_failure while adding successful tests for
all other pages.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 tests/t0101-index.sh   | 1 +
 tests/t0102-summary.sh | 7 +++++++
 tests/t0104-tree.sh    | 7 +++++++
 tests/t0105-commit.sh  | 7 +++++++
 tests/t0106-diff.sh    | 7 +++++++
 5 files changed, 29 insertions(+)

diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh
index 82ef9b0..6450b9b 100755
--- a/tests/t0101-index.sh
+++ b/tests/t0101-index.sh
@@ -11,6 +11,7 @@ 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_failure 'no links with space in path' '! grep "href=./with space/" tmp'
 test_expect_success 'no tree-link' '! grep "foo/tree" tmp'
 test_expect_success 'no log-link' '! grep "foo/log" tmp'
 
diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh
index b8864cb..1d91dca 100755
--- a/tests/t0102-summary.sh
+++ b/tests/t0102-summary.sh
@@ -22,4 +22,11 @@ test_expect_success 'clone-url expanded correctly' '
 	grep "git://example.org/bar.git" tmp
 '
 
+test_expect_success 'generate with-space summary' '
+	cgit_url "with20space" >tmp
+'
+test_expect_success 'no links with space in path' '
+	! grep "href=./with space/" tmp
+'
+
 test_done
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh
index 2e140f5..de8c4f8 100755
--- a/tests/t0104-tree.sh
+++ b/tests/t0104-tree.sh
@@ -29,4 +29,11 @@ test_expect_success 'verify a+b?h=1+2 link' '
 	grep "/foo+bar/tree/a+b?h=1%2b2" tmp
 '
 
+test_expect_success 'generate with%20space/tree' '
+	cgit_url "with%20space/tree" >tmp
+'
+test_expect_success 'no links with space in path' '
+	! grep "href=./with space/" tmp
+'
+
 test_done
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 9cdf55c..1932d5f 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -33,4 +33,11 @@ test_expect_success 'root commit contains diff' '
 	grep "<div class=.add.>+1</div>" tmp
 '
 
+test_expect_success 'generate with%20space/commit' '
+	cgit_url "with%20space/commit" >tmp
+'
+test_expect_success 'no links with space in path' '
+	! grep "href=./with space/" tmp
+'
+
 test_done
diff --git a/tests/t0106-diff.sh b/tests/t0106-diff.sh
index 82b645e..89532f5 100755
--- a/tests/t0106-diff.sh
+++ b/tests/t0106-diff.sh
@@ -16,4 +16,11 @@ test_expect_success 'find added line' '
 	grep "<div class=.add.>+5</div>" tmp
 '
 
+test_expect_success 'generate with%20space/diff' '
+	cgit_url "with%20space/diff" >tmp
+'
+test_expect_success 'no links with space in path' '
+	! grep "href=./with space/" tmp
+'
+
 test_done
-- 
2.12.0.415.g6c14041932.dirty



More information about the CGit mailing list