Diff options
Diffstat (limited to '')
-rwxr-xr-xtests/t0502-syntax-highlight.sh21
1 file changed, 12 insertions, 9 deletions
diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh
index ced9edd..2ca3c9f 100755
--- a/tests/t0502-syntax-highlight.sh
+++ b/tests/t0502-syntax-highlight.sh
@@ -7,17 +7,14 @@
# fake lexers found and once with an empty directory so the escaped fallback
# is what everything renders through. The run through cgit itself places the
# fake lexers beside the config file, which is the probe the filter documents
-# for a scintillua directory next to cgitrc.
+# for a scintillua directory next to cgitrc, and then points the lexer path
+# at nothing to see the page fall back to escaped text.
test_description='Check the shipped syntax-highlight extension'
CGIT_TEST_NO_CREATE_REPOS=YesPlease
. ./setup.sh
. "$TEST_OUTPUT_DIRECTORY/extensions/lib.sh"
-interpreters=$(ext_lua_interpreters 5)
-test -z "$interpreters" &&
- say 'no standalone lua on the path, unit checks skipped'
-
for lua in $interpreters
do
test_expect_success "highlighting checks under $lua" "
@@ -34,10 +31,6 @@ do
"
done
-test "$CGIT_HAS_LUA" -eq 1 && test_set_prereq CGIT_LUA
-test "$CGIT_HAS_LUA" -eq 1 ||
- say 'cgit built without lua, filter checks through cgit skipped'
-
test_expect_success 'create a repository holding a lexable file' '
test_create_repo repos/fake &&
(
@@ -70,6 +63,16 @@ test_expect_success CGIT_LUA 'bytes between tokens reach the page escaped' '
grep "<span class=.hl-number.>42</span> &amp; " tmp
'
+# A missing scintillua leaves the filter with nothing to highlight with, and
+# a filter that failed there would take the whole page down with it, so it
+# has to hand the source back escaped instead.
+test_expect_success CGIT_LUA 'without scintillua the source is served escaped' '
+ CGIT_SCINTILLUA_PATH=/nonexistent CGIT_CONFIG="$PWD/cgitrc" \
+ QUERY_STRING="url=fake/tree/hello.fake" cgit >tmp &&
+ grep "if 42 &amp; zz" tmp &&
+ ! grep "hl-keyword" tmp
+'
+
test_expect_success CGIT_LUA 'a lone carriage return reaches the page as an escape' '
(
cd repos/fake &&