Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin Add unit-tests for col from FreeBSD



details:   https://anonhg.NetBSD.org/src/rev/9526247e7c7a
branches:  trunk
changeset: 956588:9526247e7c7a
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 01 22:28:32 2020 +0000

description:
Add unit-tests for col from FreeBSD

diffstat:

 tests/usr.bin/Makefile     |    4 +-
 tests/usr.bin/col/Makefile |   19 +++++++
 tests/usr.bin/col/hlf.in   |    2 +
 tests/usr.bin/col/hlf2.in  |    1 +
 tests/usr.bin/col/nl.in    |    2 +
 tests/usr.bin/col/nl2.in   |    2 +
 tests/usr.bin/col/nl3.in   |    4 +
 tests/usr.bin/col/rlf.in   |    2 +
 tests/usr.bin/col/rlf2.in  |    2 +
 tests/usr.bin/col/rlf3.in  |    1 +
 tests/usr.bin/col/t_col.sh |  114 +++++++++++++++++++++++++++++++++++++++++++++
 11 files changed, 151 insertions(+), 2 deletions(-)

diffs (210 lines):

diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/Makefile
--- a/tests/usr.bin/Makefile    Sun Nov 01 22:27:15 2020 +0000
+++ b/tests/usr.bin/Makefile    Sun Nov 01 22:28:32 2020 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: Makefile,v 1.33 2020/07/03 04:25:28 jruoho Exp $
+#      $NetBSD: Makefile,v 1.34 2020/11/01 22:28:32 christos Exp $
 #
 
 .include <bsd.own.mk>
 
 TESTSDIR=       ${TESTSBASE}/usr.bin
 
-TESTS_SUBDIRS= awk basename bzip2 cc cmp config cpio cut \
+TESTS_SUBDIRS= awk basename bzip2 cc cmp config cpio col cut \
                diff dirname find fstat gdb grep gzip id indent \
                infocmp jot ld locale m4 make mixerctl mkdep nbperf \
                netpgpverify patch pkill pr printf pwhash rump_server \
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/Makefile        Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,19 @@
+# $FreeBSD: head/usr.bin/col/tests/Makefile 366577 2020-10-09 15:27:37Z markj $
+
+PACKAGE=       tests
+
+TESTSDIR=      ${TESTSBASE}/usr.bin/col
+TESTS_SH=      t_col
+
+FILESDIR=       ${TESTSDIR}
+FILES+=                \
+               hlf.in \
+               hlf2.in \
+               nl.in \
+               nl2.in \
+               nl3.in \
+               rlf.in \
+               rlf2.in \
+               rlf3.in
+
+.include <bsd.test.mk>
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/hlf.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/hlf.in  Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,2 @@
+a
+a8f8f
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/hlf2.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/hlf2.in Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,1 @@
+a9f
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/nl.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/nl.in   Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,2 @@
+a
+b
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/nl2.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/nl2.in  Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,2 @@
+a
+b
\ No newline at end of file
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/nl3.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/nl3.in  Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,4 @@
+a
+
+b
+
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/rlf.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/rlf.in  Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,2 @@
+a
+  7b
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/rlf2.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/rlf2.in Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,2 @@
+a
+       7b
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/rlf3.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/rlf3.in Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,1 @@
+ab
diff -r 30d610a86722 -r 9526247e7c7a tests/usr.bin/col/t_col.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/col/t_col.sh        Sun Nov 01 22:28:32 2020 +0000
@@ -0,0 +1,114 @@
+#!/usr/bin/atf-sh
+# $FreeBSD: head/usr.bin/col/tests/col_test.sh 366577 2020-10-09 15:27:37Z markj $
+
+atf_test_case nl
+
+nl_head()
+{
+       atf_set "descr" "testing just newlines"
+}
+nl_body()
+{
+       atf_check \
+               -o inline:"a\nb\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/nl.in
+
+       atf_check \
+               -o inline:"a\nb\n" \
+               -e empty \
+               -s exit:0 \
+               col -f < $(atf_get_srcdir)/nl.in
+
+       atf_check \
+               -o inline:"a\nb\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/nl2.in
+
+       atf_check \
+               -o inline:"a\nb\n" \
+               -e empty \
+               -s exit:0 \
+               col -f < $(atf_get_srcdir)/nl2.in
+
+       atf_check \
+               -o inline:"a\n\nb\n\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/nl3.in
+}
+
+atf_test_case rlf
+
+rlf_head()
+{
+       atf_set "descr" "testing reverse line feed"
+}
+rlf_body()
+{
+       atf_check \
+               -o inline:"a b\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/rlf.in
+
+       atf_check \
+               -o inline:"a    b\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/rlf2.in
+
+       atf_check \
+               -o inline:"a       b\n" \
+               -e empty \
+               -s exit:0 \
+               col -x < $(atf_get_srcdir)/rlf2.in
+
+       atf_check \
+               -o inline:" b\na\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/rlf3.in
+}
+
+atf_test_case hlf
+
+hlf_head()
+{
+       atf_set "descr" "testing half line feed"
+}
+hlf_body()
+{
+       atf_check \
+               -o inline:"a f\naf\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/hlf.in
+
+       atf_check \
+               -o inline:"a f9
 f9
a\n" \
+               -e empty \
+               -s exit:0 \
+               col -f < $(atf_get_srcdir)/hlf.in
+
+       atf_check \
+               -o inline:"a\n f\n" \
+               -e empty \
+               -s exit:0 \
+               col < $(atf_get_srcdir)/hlf2.in
+
+       atf_check \
+               -o inline:"a9
 f\n9"  \
+               -e empty \
+               -s exit:0 \
+               col -f < $(atf_get_srcdir)/hlf2.in
+}
+
+atf_init_test_cases()
+{
+       atf_add_test_case nl
+       atf_add_test_case rlf
+       atf_add_test_case hlf
+}



Home | Main Index | Thread Index | Old Index