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/t0204-limits.sh23
-rwxr-xr-xtests/t0502-syntax-highlight.sh13
2 files changed, 12 insertions, 24 deletions
diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh
index 2d33368..2a8bb20 100755
--- a/tests/t0204-limits.sh
+++ b/tests/t0204-limits.sh
@@ -4,17 +4,10 @@
# on the lines and files a diff renders inline, on the size of a blob any
# view will inflate, and the clamp on index query length. Crossing one has
# to trim the page or point somewhere better suited, never drop the request.
-# The last case is the same idea applied to a filter, which degrades to
-# escaped text when its highlighting library is absent.
test_description='Check the ref listing and diff size limits'
. ./setup.sh
-if test "$CGIT_HAS_LUA" -eq 1
-then
- test_set_prereq LUA
-fi
-
# The limits only show themselves against content that crosses them, so the
# fixture carries more branches and tags than max-ref-count allows and a
# commit whose oversized file diff sits beside a small one, which is what
@@ -198,22 +191,6 @@ test_expect_success 'every page showing a blob refuses an oversized one alike' '
done
'
-# A missing scintillua leaves the shipped 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 LUA 'highlight filter passes text through without scintillua' '
- {
- echo "virtual-root=/" &&
- echo "cache-size=0" &&
- echo "source-filter=lua:$(cd "$TEST_OUTPUT_DIRECTORY/../custom/extensions" && pwd)/syntax-highlight.lua" &&
- echo "repo.url=limits" &&
- echo "repo.path=$PWD/repos/limits/.git"
- } >hlrc &&
- CGIT_SCINTILLUA_PATH=/nonexistent CGIT_CONFIG="$PWD/hlrc" \
- QUERY_STRING="url=limits/tree/small.c" cgit >tmp &&
- grep "int y;" tmp
-'
-
# The patch and rawdiff pages hand the work to git, whose own limit on an
# inlined blob is far past max-blob-size, so the cap is passed through to it.
test_expect_success 'patch and rawdiff show an oversized blob as binary' '
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 &&