diff options
Diffstat (limited to 'tests/t0501-about-render.sh')
-rwxr-xr-xtests/t0501-about-render.sh17
1 file changed, 15 insertions, 2 deletions
diff --git a/tests/t0501-about-render.sh b/tests/t0501-about-render.sh
index f870c0e..b47c11d 100755
--- a/tests/t0501-about-render.sh
+++ b/tests/t0501-about-render.sh
@@ -36,9 +36,12 @@ test_expect_success 'create a repository with a markdown readme' '
# The Title
A **bold** claim and a <script>alert(1)</script> attempt.
+
+ See the [roadmap](ROADMAP.md#plan).
EOF
git add README.md &&
- git commit -m "add readme"
+ git commit -m "add readme" &&
+ git branch next
)
'
@@ -48,7 +51,7 @@ test_expect_success 'point cgit at it through the about filter' '
cache-size=0
repo.url=md
repo.path=$PWD/repos/md/.git
- repo.readme=master:README.md
+ repo.readme=:README.md
repo.about-filter=lua:$EXTENSIONS_DIRECTORY/about-render.lua
EOF
'
@@ -78,6 +81,16 @@ test_expect_success CGIT_LUA_LPEG 'readme markup reaches the page escaped' '
! 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
+'
+
+test_expect_success CGIT_LUA_LPEG 'the link stays on the branch shown' '
+ cgit_query "url=md/about/&h=next" >tmp &&
+ grep "<a href=./md/tree/ROADMAP.md?h=next#plan.>roadmap</a>" tmp
+'
+
test_expect_success CGIT_LUA_NOLPEG 'without lpeg the readme is served escaped' '
cgit_url "md/about/" >tmp &&
grep "<pre class=.plaintext.>" tmp &&