aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ident/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-07-26 11:21:36 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-07-26 11:21:36 +0000
commitc048a83f5192d293094d4e0bec4ebdbd005e0bae (patch)
tree2fd9cfca9282ae9a513f748e8348480e9776c79f /usr.bin/ident/tests
parentda6c24e123811d0c0db790f2e815cda57d7f8578 (diff)
Notes
Diffstat (limited to 'usr.bin/ident/tests')
-rw-r--r--usr.bin/ident/tests/Makefile11
-rwxr-xr-xusr.bin/ident/tests/ident.sh16
-rw-r--r--usr.bin/ident/tests/test.in15
-rw-r--r--usr.bin/ident/tests/test.out6
-rw-r--r--usr.bin/ident/tests/testnoid0
5 files changed, 48 insertions, 0 deletions
diff --git a/usr.bin/ident/tests/Makefile b/usr.bin/ident/tests/Makefile
new file mode 100644
index 0000000000000..cc29bb8c6f8e6
--- /dev/null
+++ b/usr.bin/ident/tests/Makefile
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/ident
+
+ATF_TESTS_SH= ident
+FILES= test.in \
+ test.out \
+ testnoid
+FILESDIR= ${TESTSDIR}
+
+.include <bsd.test.mk>
diff --git a/usr.bin/ident/tests/ident.sh b/usr.bin/ident/tests/ident.sh
new file mode 100755
index 0000000000000..5a3118254bfa8
--- /dev/null
+++ b/usr.bin/ident/tests/ident.sh
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+atf_test_case ident
+ident_body() {
+ atf_check -o file:$(atf_get_srcdir)/test.out \
+ ident < $(atf_get_srcdir)/test.in
+ atf_check -o match:'Foo.*' -s exit:1 \
+ -e inline:"ident warning: no id keywords in $(atf_get_srcdir)/testnoid\n" \
+ ident $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid
+ atf_check -o match:'Foo.*' -s exit:1 \
+ ident -q $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid
+}
+atf_init_test_cases()
+{
+ atf_add_test_case ident
+}
diff --git a/usr.bin/ident/tests/test.in b/usr.bin/ident/tests/test.in
new file mode 100644
index 0000000000000..634943833ce53
--- /dev/null
+++ b/usr.bin/ident/tests/test.in
@@ -0,0 +1,15 @@
+# tranditional
+ $Foo: bar $ (OK traditional)
+ $$Foo: bar $
+ $$Fo$o: bar $
+ $Fo$o: bar $
+ $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :)
+ $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :)
+ $Foo: bar $ (WRONG -- NO SPACE AFTER :)
+ $Foo:bar $ (WRONG -- NO SPACE AFTER :)
+ $Foo: bar$ (WRONG -- NO SPACE BEFORE $))
+# Subversion like
+ $Bar:: baz$ (WRONG -- NO SPACE BEFORE $)
+ $Bar:: baz $ (OK -- SPACE BEFORE $)
+ $Qux:: frobby zow#$ (OK -- HASH BEFORE $)' '
+
diff --git a/usr.bin/ident/tests/test.out b/usr.bin/ident/tests/test.out
new file mode 100644
index 0000000000000..36cccc9b20988
--- /dev/null
+++ b/usr.bin/ident/tests/test.out
@@ -0,0 +1,6 @@
+ $Foo: bar $
+ $Foo: bar $
+ $o: bar $
+ $o: bar $
+ $Bar:: baz $
+ $Qux:: frobby zow#$
diff --git a/usr.bin/ident/tests/testnoid b/usr.bin/ident/tests/testnoid
new file mode 100644
index 0000000000000..e69de29bb2d1d
--- /dev/null
+++ b/usr.bin/ident/tests/testnoid