Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0104-tree.sh | 19 |
1 file changed, 18 insertions, 1 deletion
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 9d6e542..490abb3 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -245,7 +245,24 @@ test_expect_success 'a binary file in the tree shows as a hex dump' ' cgitrc_repo binrc bin && cgit_rc binrc "url=bin/tree/blob.bin" >tmp && grep "<table class=.bin-blob.>" tmp && - grep "<td class=.right.>0000</td><td class=.hex.> 00 01 02 62 69 6e" tmp + grep "<td class=.right.>0000</td><td class=.hex.> 00 01 02 62 69 6e" tmp && + ! grep "class=.truncated." tmp +' + +# Each byte of the dump costs several bytes of markup, so a large binary is +# dumped up to its first 64 KB and links to the whole file. +test_expect_success 'a large binary is dumped only in part' ' + ( + cd repos/bin && + printf "\\000" >big.bin && + test_seq 1 20000 >>big.bin && + git add big.bin && + git commit -m "large binary" + ) && + cgit_rc binrc "url=bin/tree/big.bin" >tmp && + grep "<td class=.right.>ffe0</td>" tmp && + ! grep "<td class=.right.>10000</td>" tmp && + grep "<div class=.truncated.>Only the first 64 KB of this file are shown. <a href=./bin/plain/big.bin.>View the whole file</a>.</div>" tmp ' test_done |
