Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Tighten the checks that match stray text
Every page holds foo in its footer element, the foo+bar row holds bar,
the branch switcher holds master, and commit 1 and file-1 also match
commits 10 to 19 and file-10 to file-19. A search page repeats its term
in the search box. So these checks passed on pages that lacked what
they look for, and each now matches the link itself.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0101-index.sh | 4 | |
| -rwxr-xr-x | tests/t0102-summary.sh | 4 | |
| -rwxr-xr-x | tests/t0103-log.sh | 4 | |
| -rwxr-xr-x | tests/t0104-tree.sh | 2 | |
| -rwxr-xr-x | tests/t0204-limits.sh | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index 8d389b6..e50f0f8 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -11,9 +11,9 @@ 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 repo' 'grep ">foo</a>" 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 repo' 'grep ">bar</a>" 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' diff --git a/tests/t0102-summary.sh b/tests/t0102-summary.sh index 7df18e4..8d44ef4 100755 --- a/tests/t0102-summary.sh +++ b/tests/t0102-summary.sh @@ -11,7 +11,7 @@ test_description='Check content on summary page' test_expect_success 'generate foo summary' 'cgit_url "foo" >tmp' test_expect_success 'find commit 1' 'grep "commit 1" tmp' test_expect_success 'find commit 5' 'grep "commit 5" tmp' -test_expect_success 'find branch master' 'grep "master" tmp' +test_expect_success 'find branch master' 'grep "<tr class=.branch.><td><a[^>]*>master</a>" tmp' test_expect_success 'no tags' '! grep "Tag</th>" tmp' test_expect_success 'clone-url expanded correctly' ' grep "git://example.org/foo.git" tmp @@ -24,7 +24,7 @@ test_expect_success 'repo description reaches the meta tag' ' test_expect_success 'no commit 45' '! grep "commit 45" tmp' test_expect_success 'find commit 46' 'grep "commit 46" tmp' test_expect_success 'find commit 50' 'grep "commit 50" tmp' -test_expect_success 'find branch master' 'grep "master" tmp' +test_expect_success 'find branch master' 'grep "<tr class=.branch.><td><a[^>]*>master</a>" tmp' test_expect_success 'no tags' '! grep "Tag</th>" tmp' test_expect_success 'clone-url expanded correctly' ' grep "git://example.org/bar.git" tmp diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index 98b4e0b..927c814 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -12,7 +12,7 @@ test_expect_success 'find commit 1' 'grep "commit 1" tmp' test_expect_success 'find commit 5' 'grep "commit 5" tmp' test_expect_success 'generate bar/log' 'cgit_url "bar/log" >tmp' -test_expect_success 'find commit 1' 'grep "commit 1" tmp' +test_expect_success 'find commit 1' 'grep ">commit 1<" tmp' test_expect_success 'find commit 50' 'grep "commit 50" tmp' # The switch button submits the select as h, so whatever head the request @@ -38,7 +38,7 @@ test_expect_success 'a branch head keeps its plain option' ' test_expect_success 'generate "with%20space/log?qt=grep&q=commit+1"' ' cgit_url "with+space/log&qt=grep&q=commit+1" >tmp ' -test_expect_success 'find commit 1' 'grep "commit 1" tmp' +test_expect_success 'find commit 1' 'grep ">commit 1<" tmp' test_expect_success 'find link with %20 in path' 'grep "/with%20space/log/?qt=grep" tmp' test_expect_success 'find link with + in arg' 'grep "/log/?qt=grep&q=commit+1" tmp' test_expect_success 'no links with space in path' '! grep "href=./with space/" tmp' diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 0ed98a6..2572a4d 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -9,7 +9,7 @@ test_description='Check content on tree page' . ./setup.sh test_expect_success 'generate bar/tree' 'cgit_url "bar/tree" >tmp' -test_expect_success 'find file-1' 'grep "file-1" tmp' +test_expect_success 'find file-1' 'grep ">file-1<" tmp' test_expect_success 'find file-50' 'grep "file-50" tmp' test_expect_success 'the links column has a name' ' grep "<th class=.ls-links. scope=.col. aria-label=.Links.></th>" tmp diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index 2a8bb20..e6d69bd 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -64,7 +64,7 @@ test_expect_success 'an enormous query is clamped, not rejected' ' test_expect_success 'an ordinary query still filters the index' ' cgit_query "q=foo" >tmp && - grep "foo" tmp && + grep ">foo</a>" tmp && ! grep ">bar<" tmp ' |
