Module Name:    src
Committed By:   christos
Date:           Sun Nov  1 22:28:33 UTC 2020

Modified Files:
        src/tests/usr.bin: Makefile
Added Files:
        src/tests/usr.bin/col: Makefile hlf.in hlf2.in nl.in nl2.in nl3.in
            rlf.in rlf2.in rlf3.in t_col.sh

Log Message:
Add unit-tests for col from FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/col/Makefile \
    src/tests/usr.bin/col/hlf.in src/tests/usr.bin/col/hlf2.in \
    src/tests/usr.bin/col/nl.in src/tests/usr.bin/col/nl2.in \
    src/tests/usr.bin/col/nl3.in src/tests/usr.bin/col/rlf.in \
    src/tests/usr.bin/col/rlf2.in src/tests/usr.bin/col/rlf3.in \
    src/tests/usr.bin/col/t_col.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.33 src/tests/usr.bin/Makefile:1.34
--- src/tests/usr.bin/Makefile:1.33	Fri Jul  3 00:25:28 2020
+++ src/tests/usr.bin/Makefile	Sun Nov  1 17:28:32 2020
@@ -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 \

Added files:

Index: src/tests/usr.bin/col/Makefile
diff -u /dev/null src/tests/usr.bin/col/Makefile:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/Makefile	Sun Nov  1 17:28:32 2020
@@ -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>
Index: src/tests/usr.bin/col/hlf.in
diff -u /dev/null src/tests/usr.bin/col/hlf.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/hlf.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,2 @@
+a
+a8f8f
Index: src/tests/usr.bin/col/hlf2.in
diff -u /dev/null src/tests/usr.bin/col/hlf2.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/hlf2.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1 @@
+a9f
Index: src/tests/usr.bin/col/nl.in
diff -u /dev/null src/tests/usr.bin/col/nl.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/nl.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,2 @@
+a
+b
Index: src/tests/usr.bin/col/nl2.in
diff -u /dev/null src/tests/usr.bin/col/nl2.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/nl2.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,2 @@
+a
+b
\ No newline at end of file
Index: src/tests/usr.bin/col/nl3.in
diff -u /dev/null src/tests/usr.bin/col/nl3.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/nl3.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,4 @@
+a
+
+b
+
Index: src/tests/usr.bin/col/rlf.in
diff -u /dev/null src/tests/usr.bin/col/rlf.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/rlf.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,2 @@
+a
+  7b
Index: src/tests/usr.bin/col/rlf2.in
diff -u /dev/null src/tests/usr.bin/col/rlf2.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/rlf2.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1,2 @@
+a
+	7b
Index: src/tests/usr.bin/col/rlf3.in
diff -u /dev/null src/tests/usr.bin/col/rlf3.in:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/rlf3.in	Sun Nov  1 17:28:32 2020
@@ -0,0 +1 @@
+ab
Index: src/tests/usr.bin/col/t_col.sh
diff -u /dev/null src/tests/usr.bin/col/t_col.sh:1.1
--- /dev/null	Sun Nov  1 17:28:33 2020
+++ src/tests/usr.bin/col/t_col.sh	Sun Nov  1 17:28:32 2020
@@ -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 f9a\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
+}

Reply via email to