Debian Codegraph @

tests/new-file

raw
1 #!/bin/sh
2 # Test --new-file (-N) and --unidirectional-new-file.
3
4 . "${srcdir=.}/init.sh"; path_prepend_ ../src
5
6 fail=0
7
8 echo a > a || fail=1
9
10 echo '0a1
11 > a' > exp || fail=1
12
13 returns_ 1 diff -N b a > out || fail=1
14 compare exp out || fail=1
15
16 returns_ 1 diff -N b - < a > out || fail=1
17 compare exp out || fail=1
18
19 returns_ 1 diff --unidirectional-new-file b - < a > out || fail=1
20 compare exp out || fail=1
21
22 echo '1d0
23 < a' > exp || fail=1
24
25 returns_ 1 diff -N - b < a > out || fail=1
26 compare exp out || fail=1
27
28 returns_ 2 diff --unidirectional-new-file - b < a > out || fail=1
29
30 Exit $fail