| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is a lsdiff(1) testcase for multiple verbose levels. |
| 4 |
# Test: -v, -vv, and -nvv for different levels of verbosity |
| 5 |
|
| 6 |
. ${top_srcdir-.}/tests/common.sh |
| 7 |
|
| 8 |
cat << EOF > diff |
| 9 |
--- file1 |
| 10 |
+++ file1 |
| 11 |
@@ -1,3 +1,4 @@ function1 |
| 12 |
first line |
| 13 |
-old content |
| 14 |
+new content |
| 15 |
+added line |
| 16 |
third line |
| 17 |
@@ -10,4 +11,3 @@ function2 |
| 18 |
context line |
| 19 |
-removed line |
| 20 |
another line |
| 21 |
-old ending |
| 22 |
+new ending |
| 23 |
--- file2 |
| 24 |
+++ file2 |
| 25 |
@@ -5,2 +5,3 @@ main |
| 26 |
some context |
| 27 |
-original text |
| 28 |
+modified text |
| 29 |
+extra line |
| 30 |
EOF |
| 31 |
|
| 32 |
# Test single -v (basic verbose - same as no flags for lsdiff) |
| 33 |
${LSDIFF} -v diff 2>errors >verbose1 || exit 1 |
| 34 |
[ -s errors ] && exit 1 |
| 35 |
|
| 36 |
cat << EOF | cmp - verbose1 || exit 1 |
| 37 |
file1 |
| 38 |
file2 |
| 39 |
EOF |
| 40 |
|
| 41 |
# Test double -vv (extra verbose - same as single -v for lsdiff) |
| 42 |
${LSDIFF} -vv diff 2>errors >verbose2 || exit 1 |
| 43 |
[ -s errors ] && exit 1 |
| 44 |
|
| 45 |
cat << EOF | cmp - verbose2 || exit 1 |
| 46 |
file1 |
| 47 |
file2 |
| 48 |
EOF |
| 49 |
|
| 50 |
# Test -nvv (numbered extra verbose) |
| 51 |
${LSDIFF} -nvv diff 2>errors >verbose_nvv || exit 1 |
| 52 |
[ -s errors ] && exit 1 |
| 53 |
|
| 54 |
cat << EOF | cmp - verbose_nvv || exit 1 |
| 55 |
1 File #1 file1 |
| 56 |
3 Hunk #1 function1 |
| 57 |
9 Hunk #2 function2 |
| 58 |
15 File #2 file2 |
| 59 |
17 Hunk #1 main |
| 60 |
EOF |