aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2017-04-20 11:32:18 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2017-04-20 11:32:18 +0000
commit05d06ecac32d892eafc5e8e13652324d8f5ac46a (patch)
treebfe953eab850bb8ace619d3a95a72114e0961457 /usr.bin/diff/tests
parent00eab743abca6918aca3ad165c1707ab70f7037f (diff)
Notes
Diffstat (limited to 'usr.bin/diff/tests')
-rw-r--r--usr.bin/diff/tests/Makefile3
-rwxr-xr-xusr.bin/diff/tests/diff_test.sh9
-rw-r--r--usr.bin/diff/tests/ifdef.out26
3 files changed, 37 insertions, 1 deletions
diff --git a/usr.bin/diff/tests/Makefile b/usr.bin/diff/tests/Makefile
index 4dfa372f2c4d..295e3141f3d9 100644
--- a/usr.bin/diff/tests/Makefile
+++ b/usr.bin/diff/tests/Makefile
@@ -21,7 +21,8 @@ ${PACKAGE}FILES+= \
unified_c9999.out \
unified_9999.out \
header.out \
- header_ns.out
+ header_ns.out \
+ ifdef.out
NETBSD_ATF_TESTS_SH+= netbsd_diff_test
diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh
index c712d5871480..589bc9a8603b 100755
--- a/usr.bin/diff/tests/diff_test.sh
+++ b/usr.bin/diff/tests/diff_test.sh
@@ -4,6 +4,7 @@ atf_test_case simple
atf_test_case unified
atf_test_case header
atf_test_case header_ns
+atf_test_case ifdef
simple_body()
{
@@ -70,10 +71,18 @@ header_ns_body()
diff -u empty hello
}
+ifdef_body()
+{
+ atf_check -o file:$(atf_get_srcdir)/ifdef.out -s eq:1 \
+ diff -D PLOP "$(atf_get_srcdir)/input_c1.in" \
+ "$(atf_get_srcdir)/input_c2.in"
+}
+
atf_init_test_cases()
{
atf_add_test_case simple
atf_add_test_case unified
atf_add_test_case header
atf_add_test_case header_ns
+ atf_add_test_case ifdef
}
diff --git a/usr.bin/diff/tests/ifdef.out b/usr.bin/diff/tests/ifdef.out
new file mode 100644
index 000000000000..cc72cac08635
--- /dev/null
+++ b/usr.bin/diff/tests/ifdef.out
@@ -0,0 +1,26 @@
+/*
+ * A comment
+ *
+#ifndef PLOP
+ * And another bla
+#else /* PLOP */
+ * And another bla
+#endif /* PLOP */
+ *
+#ifndef PLOP
+ * And yet another
+#else /* PLOP */
+ * and yet another
+#endif /* PLOP */
+ */
+
+int
+main(void)
+{
+#ifdef PLOP
+
+#endif /* PLOP */
+ printf("something");
+
+ return (0);
+}