Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Move the highlighter fallback check into t0502
t0502 owns the shipped highlighter and already writes a cgitrc naming it, so the check needs no config of its own there. t0204's header still called it the last case long after it stopped being one.
Diffstat (limited to '')
-rwxr-xr-xtests/t0502-syntax-highlight.sh13
1 file changed, 12 insertions, 1 deletion
diff --git a/tests/t0502-syntax-highlight.sh b/tests/t0502-syntax-highlight.sh
index ced9edd..4c0e412 100755
--- a/tests/t0502-syntax-highlight.sh
+++ b/tests/t0502-syntax-highlight.sh
@@ -7,7 +7,8 @@
# 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
@@ -70,6 +71,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 &&