File: large-subopt

package info (click to toggle)
diffutils 1%3A3.10-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,784 kB
  • sloc: ansic: 90,222; sh: 11,672; perl: 450; makefile: 225; sed: 16
file content (27 lines) | stat: -rw-r--r-- 641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# This test is expected to fail at least with diffutils-3.6.
# Demonstrate how diff can produce suboptimal output.
# With these two files, diff -u prints output including this:
# -2
# +L: 361
# +L: 361
# +2
# The trouble is that "2" line that is both added and removed.
# This smaller patch could induce the same change:
# +L: 361
# +L: 361

. "${srcdir=.}/init.sh"; path_prepend_ ../src

require_perl_

fail=0

diff -u \
  "$abs_top_srcdir/tests/large-subopt.in1" \
  "$abs_top_srcdir/tests/large-subopt.in2" \
  | $PERL -n0 -e \
     '/\n-2\n(\+L: 361\n){2}\+2\n/ and do {$e=1; last}; END{exit !$e}' \
     && fail=1

Exit $fail