Diff options
| -rwxr-xr-x | tests/t0501-about-render.sh | 38 | |
| -rwxr-xr-x | tests/t0502-syntax-highlight.sh | 13 | |
| -rwxr-xr-x | tests/t0503-link-commits.sh | 9 | |
| -rwxr-xr-x | tests/t0504-email-avatar.sh | 6 | |
| -rwxr-xr-x | tests/t0506-link-trailers.sh | 10 |
5 files changed, 40 insertions, 36 deletions
diff --git a/tests/t0501-about-render.sh b/tests/t0501-about-render.sh index 56f2e77..2cf84ed 100755 --- a/tests/t0501-about-render.sh +++ b/tests/t0501-about-render.sh @@ -83,39 +83,39 @@ then fi test_expect_success CGIT_LUA_LPEG 'the about page renders the markdown' ' - cgit_url "md/about/" >tmp && - grep "<h1 id=.the-title.>The Title</h1>" tmp && - grep "<strong>bold</strong>" tmp + cgit_ok_url "md/about/" >tmp && + test_grep "<h1 id=.the-title.>The Title</h1>" tmp && + test_grep "<strong>bold</strong>" tmp ' test_expect_success CGIT_LUA_LPEG 'readme markup reaches the page escaped' ' - cgit_url "md/about/" >tmp && - grep "<script>alert(1)</script>" tmp && - ! grep "<script>alert(1)" tmp + cgit_ok_url "md/about/" >tmp && + test_grep "<script>alert(1)</script>" tmp && + test_grep ! "<script>alert(1)" tmp ' test_expect_success CGIT_LUA_LPEG 'a relative link leads into the tree' ' - cgit_url "md/about/" >tmp && - grep "<a href=./md/tree/ROADMAP.md#plan.>roadmap</a>" tmp + cgit_ok_url "md/about/" >tmp && + test_grep "<a href=./md/tree/ROADMAP.md#plan.>roadmap</a>" tmp ' test_expect_success CGIT_LUA_LPEG 'the link stays on the branch shown' ' - cgit_url "md/about/&h=next" >tmp && - grep "<a href=./md/tree/ROADMAP.md?h=next#plan.>roadmap</a>" tmp + cgit_ok_url "md/about/&h=next" >tmp && + test_grep "<a href=./md/tree/ROADMAP.md?h=next#plan.>roadmap</a>" tmp ' test_expect_success CGIT_LUA_LPEG 'the about page renders a man page' ' - cgit_url "man/about/" >tmp && - grep "<div class=.markdown.><h2 id=.name.>NAME</h2>" tmp && - grep "tool - does one thing — well" tmp && - grep "<strong>-v</strong><br>" tmp && - grep "<pre><code>tool -v <file>" tmp && - ! grep "\\\\f" tmp + cgit_ok_url "man/about/" >tmp && + test_grep "<div class=.markdown.><h2 id=.name.>NAME</h2>" tmp && + test_grep "tool - does one thing — well" tmp && + test_grep "<strong>-v</strong><br>" tmp && + test_grep "<pre><code>tool -v <file>" tmp && + test_grep ! "\\\\f" tmp ' -test_expect_success CGIT_LUA 'the about page shows plain text as it is' ' - cgit_url "txt/about/" >tmp && - grep "<pre class=.plaintext.>Plain <b>notes</b> & more" tmp +test_expect_success CGIT_LUA_LPEG 'the about page shows plain text as it is' ' + cgit_ok_url "txt/about/" >tmp && + test_grep "<pre class=.plaintext.>Plain <b>notes</b> & more" tmp ' test_expect_success CGIT_LUA_NOLPEG 'without lpeg the readme is served escaped' ' diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh index dbb7bb0..186d0a8 100755 --- a/tests/t0502-syntax-highlight.sh +++ b/tests/t0502-syntax-highlight.sh @@ -54,13 +54,14 @@ test_expect_success 'place the fake lexers beside a config naming the filter' ' ' test_expect_success CGIT_LUA 'the tree view is highlighted' ' - cgit_url "fake/tree/hello.fake" >tmp && - grep "<span class=.hl-keyword.>if</span>" tmp && - grep "<span class=.hl-number.>42</span>" tmp + cgit_ok_url "fake/tree/hello.fake" >tmp && + test_grep "<span class=.hl-keyword.>if</span>" tmp && + test_grep "<span class=.hl-number.>42</span>" tmp ' test_expect_success CGIT_LUA 'bytes between tokens reach the page escaped' ' - grep "<span class=.hl-number.>42</span> & " tmp + cgit_ok_url "fake/tree/hello.fake" >tmp && + test_grep "<span class=.hl-number.>42</span> & " tmp ' # A missing scintillua leaves the filter with nothing to highlight with, and @@ -81,8 +82,8 @@ test_expect_success CGIT_LUA 'a lone carriage return reaches the page as an esca git add cr.fake && git commit -m "add a lone carriage return" ) && - cgit_url "fake/tree/cr.fake" >tmp && - grep "<span class=.hl-keyword.>if</span><span class=.escape.>\\\\r</span>" tmp + cgit_ok_url "fake/tree/cr.fake" >tmp && + test_grep "<span class=.hl-keyword.>if</span><span class=.escape.>\\\\r</span>" tmp ' test_done diff --git a/tests/t0503-link-commits.sh b/tests/t0503-link-commits.sh index d38093a..06f54dc 100755 --- a/tests/t0503-link-commits.sh +++ b/tests/t0503-link-commits.sh @@ -39,13 +39,14 @@ test_expect_success 'point cgit at it through the commit filter' ' ' test_expect_success CGIT_LUA 'the issue mark stays text on the commit page' ' - cgit_url "linky/commit/" >tmp && - grep "fix #123 near" tmp && - ! grep "bugs.example.com" tmp + cgit_ok_url "linky/commit/" >tmp && + test_grep "fix #123 near" tmp && + test_grep ! "bugs.example.com" tmp ' test_expect_success CGIT_LUA 'the object name links to its own page' ' - grep "id=deadbeefcafe1234.>deadbeefcafe1234</a>" tmp + cgit_ok_url "linky/commit/" >tmp && + test_grep "id=deadbeefcafe1234.>deadbeefcafe1234</a>" tmp ' test_done diff --git a/tests/t0504-email-avatar.sh b/tests/t0504-email-avatar.sh index ccda85a..b584f3e 100755 --- a/tests/t0504-email-avatar.sh +++ b/tests/t0504-email-avatar.sh @@ -66,9 +66,9 @@ test_expect_success CGIT_LUA 'point cgit at it through the email filter' ' # The address behind the hash is author@example.com, the identity the test # library commits under. test_expect_success CGIT_LUA_OSSL 'the commit page draws the author icon' ' - cgit_url "avatar/commit/" >tmp && - grep "gravatar.com/avatar/b0eda69977c26118feff17875d53376006568bcbcde5ca0c916d01f05c281436" tmp && - grep "loading=.lazy." tmp + cgit_ok_url "avatar/commit/" >tmp && + test_grep "gravatar.com/avatar/b0eda69977c26118feff17875d53376006568bcbcde5ca0c916d01f05c281436" tmp && + test_grep "loading=.lazy." tmp ' test_expect_success CGIT_LUA_NOOSSL 'without luaossl the page keeps the name alone' ' diff --git a/tests/t0506-link-trailers.sh b/tests/t0506-link-trailers.sh index 03db63a..42c65fd 100755 --- a/tests/t0506-link-trailers.sh +++ b/tests/t0506-link-trailers.sh @@ -46,16 +46,18 @@ test_expect_success 'point cgit at it through the trailer filter' ' ' test_expect_success CGIT_LUA 'the Fixes object name links to its commit page' ' - cgit_url "linky/commit/" >tmp && - grep "<th scope=.row.>Fixes</th><td><a href=....id=1234567.>1234567</a> (.earlier.)</td>" tmp + cgit_ok_url "linky/commit/" >tmp && + test_grep "<th scope=.row.>Fixes</th><td><a href=....id=1234567.>1234567</a> (.earlier.)</td>" tmp ' test_expect_success CGIT_LUA 'the bare URL links to itself' ' - grep "<a href=.https://example.com/?a=1&b=2.>https://example.com/?a=1&b=2</a>" tmp + cgit_ok_url "linky/commit/" >tmp && + test_grep "<a href=.https://example.com/?a=1&b=2.>https://example.com/?a=1&b=2</a>" tmp ' test_expect_success CGIT_LUA 'the Closes mark stays text' ' - grep "<th scope=.row.>Closes</th><td>#45</td>" tmp + cgit_ok_url "linky/commit/" >tmp && + test_grep "<th scope=.row.>Closes</th><td>#45</td>" tmp ' test_done |
