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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/bin/sh
# Demonstrate how -F RE behavior changed after diff-2.9.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
cat <<EOF > in || fail_ "failed to create temporary file"
procedure AdaCode is
procedure Local_Level_1 is
procedure Local_Level_2 is
procedure Local_Level_3 is
procedure Local_Level_4 is
procedure Local_Level_5 is
begin
null;
null;
null;
foo;
end;
begin
Local_Level_5;
end;
begin
Local_Level_4;
end;
begin
Local_Level_3;
end;
begin
Local_Level_2;
end;
begin
Local_Level_1;
end;
EOF
sed s/foo/null/ < in > in2 || fail_ "failed to create temporary file"
# Before diff-2.10, the function line would be truncated like this:
# @@ -8,7 +8,7 @@ procedure Local_Leve
cat <<EOF > exp || fail_ "failed to create temporary file"
@@ -8,7 +8,7 @@ procedure Local_Level_5 is
null;
null;
null;
- foo;
+ null;
end;
begin
Local_Level_5;
EOF
fail=0
diff -u -F '^[[:space:]]*\(function\|procedure\)' in in2 > out 2> err
test $? = 1 || fail=1
sed -n '3,$p' out > k && mv k out || fail=1
compare exp out || fail=1
# expect empty stderr
compare /dev/null err || fail=1
Exit $fail
|