summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorKent R. Spillner <kspillner@cvs.openbsd.org>2014-08-27 15:27:21 +0000
committerKent R. Spillner <kspillner@cvs.openbsd.org>2014-08-27 15:27:21 +0000
commit1b7072540142dcdd8eabe0499cb9673cc7ae45ff (patch)
treefb162537e98d5ca45b2625cce68cedbbbc8fa670 /regress/usr.bin
parentb9ff7b734761c97992146bee51935bb71ebc46d7 (diff)
Add regression tests for diff -uw issue reported by guenther@. Ensure the
'+' and '-' always appear in the first column of a newline in diff -uw output, even when one file doesn't end with a newline and the other file contains additional lines. ok guenther@
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/diff/Makefile17
-rw-r--r--regress/usr.bin/diff/t14.12
-rw-r--r--regress/usr.bin/diff/t14.23
-rw-r--r--regress/usr.bin/diff/t15.13
-rw-r--r--regress/usr.bin/diff/t15.22
5 files changed, 24 insertions, 3 deletions
diff --git a/regress/usr.bin/diff/Makefile b/regress/usr.bin/diff/Makefile
index 30b61aac94a..fafa16c05fd 100644
--- a/regress/usr.bin/diff/Makefile
+++ b/regress/usr.bin/diff/Makefile
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.6 2010/07/16 19:58:22 ray Exp $
+# $OpenBSD: Makefile,v 1.7 2014/08/27 15:27:20 kspillner Exp $
-REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13
+REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15
DIFF=diff
PATCH=patch
@@ -24,6 +24,10 @@ EDSKIPCMP=t7 t10 t12
# t11: rev 1.3 and 1.36 of usr.bin/ed/ed.1.
# t12: rev 1.1 and 1.2 of sbin/isakmpd/regress/hmac/Makefile.
# t13: a case to check the single dot on a line handling for ed(1) patches.
+# t14: a case to ensure unified diffs ignoring whitespace produce valid output
+# when extra lines and no newline at end of file1
+# t15: a case to ensure unified diffs ignoring whitespace produce valid output
+# when fewer lines and no newline at end of file1
.SUFFIXES: .1 .2
@@ -51,7 +55,14 @@ all: clean ${REGRESS_TARGET}
@( echo ${EDSKIPCMP} | grep -q '[[:<:]]${*}[[:>:]]' ) || \
cmp -s ${.CURDIR}/${*}.2 ${*}.e.copy || \
(echo "XXX ${*} ed diff failed" && false)
-
+
+t14.1 t15.1:
+ @cp ${.CURDIR}/${*}.1 ${*}.uw.copy
+ @${DIFF} -uw ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.uw.patch || true
+ @${PATCH} ${PATCHOPTIONS} ${*}.uw.copy ${*}.uw.patch || true
+ @cmp -s ${.CURDIR}/${*}.2 ${*}.uw.copy || \
+ (echo "XXX ${*} unified diff ignoring whitespace failed" && false)
+
# Clean all files generated
clean:
rm -f *.copy *.patch *.orig
diff --git a/regress/usr.bin/diff/t14.1 b/regress/usr.bin/diff/t14.1
new file mode 100644
index 00000000000..7a754f414cd
--- /dev/null
+++ b/regress/usr.bin/diff/t14.1
@@ -0,0 +1,2 @@
+1
+2 \ No newline at end of file
diff --git a/regress/usr.bin/diff/t14.2 b/regress/usr.bin/diff/t14.2
new file mode 100644
index 00000000000..01e79c32a8c
--- /dev/null
+++ b/regress/usr.bin/diff/t14.2
@@ -0,0 +1,3 @@
+1
+2
+3
diff --git a/regress/usr.bin/diff/t15.1 b/regress/usr.bin/diff/t15.1
new file mode 100644
index 00000000000..5f5fbe759f1
--- /dev/null
+++ b/regress/usr.bin/diff/t15.1
@@ -0,0 +1,3 @@
+1
+2
+3 \ No newline at end of file
diff --git a/regress/usr.bin/diff/t15.2 b/regress/usr.bin/diff/t15.2
new file mode 100644
index 00000000000..1191247b6d9
--- /dev/null
+++ b/regress/usr.bin/diff/t15.2
@@ -0,0 +1,2 @@
+1
+2