Add a regression test for diff -D

This commit is contained in:
Baptiste Daroussin 2017-04-20 11:32:18 +00:00
parent 00eab743ab
commit 05d06ecac3
3 changed files with 37 additions and 1 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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);
}