Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0204-limits.sh | 20 |
1 file changed, 20 insertions, 0 deletions
diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index ab68937..fc61b5c 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -270,4 +270,24 @@ test_expect_success 'patch and rawdiff show an oversized blob as binary' ' done ' +# The diff options offer up to 40 lines of context, and context lines are +# not counted against max-diff-lines, so a request asking for more is held +# at 40. One asking for less than none falls back to the default. +test_expect_success 'the context a request asks for is clamped' ' + test_create_repo repos/context && + test_seq 1 100 >repos/context/f && + git -C repos/context add f && + git -C repos/context commit -q -m one && + test_seq 1 100 | sed "s/^50$/fifty/" >repos/context/f && + git -C repos/context commit -q -a -m two && + cgitrc_repo contextrc context && + cgit_ok contextrc "url=context/commit/&context=100000" >tmp && + test_grep "class=.hunk.>@@ -10,81 +10,81 @@" tmp && + test_grep "<option value=.40. selected>40<" tmp && + test_grep ! "context=100000" tmp && + cgit_ok contextrc "url=context/commit/&context=-5" >tmp && + test_grep "class=.hunk.>@@ -47,7 +47,7 @@" tmp && + test_grep "<option value=.3. selected>3<" tmp +' + test_done |
