Debian Codegraph @

tests/large-subopt

raw
1 #!/bin/sh
2 # This test is expected to fail at least with diffutils-3.6.
3 # Demonstrate how diff can produce suboptimal output.
4 # With these two files, diff -u prints output including this:
5 # -2
6 # +L: 361
7 # +L: 361
8 # +2
9 # The trouble is that "2" line that is both added and removed.
10 # This smaller patch could induce the same change:
11 # +L: 361
12 # +L: 361
13
14 . "${srcdir=.}/init.sh"; path_prepend_ ../src
15
16 require_perl_
17
18 fail=0
19
20 diff -u \
21 "$abs_top_srcdir/tests/large-subopt.in1" \
22 "$abs_top_srcdir/tests/large-subopt.in2" \
23 | $PERL -n0 -e \
24 '/\n-2\n(\+L: 361\n){2}\+2\n/ and do {$e=1; last}; END{exit !$e}' \
25 && fail=1
26
27 Exit $fail