aboutsummaryrefslogtreecommitdiffstats
path: root/shell_cmds/printf/tests
diff options
context:
space:
mode:
Diffstat (limited to 'shell_cmds/printf/tests')
-rw-r--r--shell_cmds/printf/tests/Makefile23
-rw-r--r--shell_cmds/printf/tests/Makefile.depend11
-rw-r--r--shell_cmds/printf/tests/legacy_test.sh6
-rw-r--r--shell_cmds/printf/tests/regress.b.out1
-rw-r--r--shell_cmds/printf/tests/regress.bwidth.out1
-rw-r--r--shell_cmds/printf/tests/regress.d.out1
-rw-r--r--shell_cmds/printf/tests/regress.f.out1
-rw-r--r--shell_cmds/printf/tests/regress.l1.out1
-rw-r--r--shell_cmds/printf/tests/regress.l2.out1
-rw-r--r--shell_cmds/printf/tests/regress.m1.outbin0 -> 7 bytes
-rw-r--r--shell_cmds/printf/tests/regress.m2.out2
-rw-r--r--shell_cmds/printf/tests/regress.m3.out4
-rw-r--r--shell_cmds/printf/tests/regress.m4.out1
-rw-r--r--shell_cmds/printf/tests/regress.m5.out1
-rw-r--r--shell_cmds/printf/tests/regress.missingpos1.out1
-rw-r--r--shell_cmds/printf/tests/regress.s.out1
-rw-r--r--shell_cmds/printf/tests/regress.sh32
-rw-r--r--shell_cmds/printf/tests/regress.zero.out1
18 files changed, 89 insertions, 0 deletions
diff --git a/shell_cmds/printf/tests/Makefile b/shell_cmds/printf/tests/Makefile
new file mode 100644
index 0000000..b4ea79b
--- /dev/null
+++ b/shell_cmds/printf/tests/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TAP_TESTS_SH= legacy_test
+
+${PACKAGE}FILES+= regress.b.out
+${PACKAGE}FILES+= regress.bwidth.out
+${PACKAGE}FILES+= regress.d.out
+${PACKAGE}FILES+= regress.f.out
+${PACKAGE}FILES+= regress.l1.out
+${PACKAGE}FILES+= regress.l2.out
+${PACKAGE}FILES+= regress.m1.out
+${PACKAGE}FILES+= regress.m2.out
+${PACKAGE}FILES+= regress.m3.out
+${PACKAGE}FILES+= regress.m4.out
+${PACKAGE}FILES+= regress.m5.out
+${PACKAGE}FILES+= regress.missingpos1.out
+${PACKAGE}FILES+= regress.s.out
+${PACKAGE}FILES+= regress.sh
+${PACKAGE}FILES+= regress.zero.out
+
+.include <bsd.test.mk>
diff --git a/shell_cmds/printf/tests/Makefile.depend b/shell_cmds/printf/tests/Makefile.depend
new file mode 100644
index 0000000..f80275d
--- /dev/null
+++ b/shell_cmds/printf/tests/Makefile.depend
@@ -0,0 +1,11 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+.endif
diff --git a/shell_cmds/printf/tests/legacy_test.sh b/shell_cmds/printf/tests/legacy_test.sh
new file mode 100644
index 0000000..a919deb
--- /dev/null
+++ b/shell_cmds/printf/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 /AppleInternal/Tests/shell_cmds/regress.m4 "${SRCDIR}/regress.sh" | sh
diff --git a/shell_cmds/printf/tests/regress.b.out b/shell_cmds/printf/tests/regress.b.out
new file mode 100644
index 0000000..0373d93
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.b.out
@@ -0,0 +1 @@
+abcdef
diff --git a/shell_cmds/printf/tests/regress.bwidth.out b/shell_cmds/printf/tests/regress.bwidth.out
new file mode 100644
index 0000000..9e2ff61
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.bwidth.out
@@ -0,0 +1 @@
+ a
diff --git a/shell_cmds/printf/tests/regress.d.out b/shell_cmds/printf/tests/regress.d.out
new file mode 100644
index 0000000..da83c08
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.d.out
@@ -0,0 +1 @@
+123, 123,00123,00123,00123
diff --git a/shell_cmds/printf/tests/regress.f.out b/shell_cmds/printf/tests/regress.f.out
new file mode 100644
index 0000000..127cb8a
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.f.out
@@ -0,0 +1 @@
+42.250000,-42.250 ,inf,nan
diff --git a/shell_cmds/printf/tests/regress.l1.out b/shell_cmds/printf/tests/regress.l1.out
new file mode 100644
index 0000000..9be0dc9
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.l1.out
@@ -0,0 +1 @@
+228
diff --git a/shell_cmds/printf/tests/regress.l2.out b/shell_cmds/printf/tests/regress.l2.out
new file mode 100644
index 0000000..9be0dc9
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.l2.out
@@ -0,0 +1 @@
+228
diff --git a/shell_cmds/printf/tests/regress.m1.out b/shell_cmds/printf/tests/regress.m1.out
new file mode 100644
index 0000000..a9e063e
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.m1.out
Binary files differ
diff --git a/shell_cmds/printf/tests/regress.m2.out b/shell_cmds/printf/tests/regress.m2.out
new file mode 100644
index 0000000..cf14915
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.m2.out
@@ -0,0 +1,2 @@
+abc
+cdef \ No newline at end of file
diff --git a/shell_cmds/printf/tests/regress.m3.out b/shell_cmds/printf/tests/regress.m3.out
new file mode 100644
index 0000000..bbe4e70
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.m3.out
@@ -0,0 +1,4 @@
+%abc
+%def
+%ghi
+%jkl
diff --git a/shell_cmds/printf/tests/regress.m4.out b/shell_cmds/printf/tests/regress.m4.out
new file mode 100644
index 0000000..5e0b5d4
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.m4.out
@@ -0,0 +1 @@
+0,0.000000,,
diff --git a/shell_cmds/printf/tests/regress.m5.out b/shell_cmds/printf/tests/regress.m5.out
new file mode 100644
index 0000000..2838468
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.m5.out
@@ -0,0 +1 @@
+-d
diff --git a/shell_cmds/printf/tests/regress.missingpos1.out b/shell_cmds/printf/tests/regress.missingpos1.out
new file mode 100644
index 0000000..3b04f03
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.missingpos1.out
@@ -0,0 +1 @@
+printf: incomplete use of n$
diff --git a/shell_cmds/printf/tests/regress.s.out b/shell_cmds/printf/tests/regress.s.out
new file mode 100644
index 0000000..3d572b9
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.s.out
@@ -0,0 +1 @@
+abc,abc
diff --git a/shell_cmds/printf/tests/regress.sh b/shell_cmds/printf/tests/regress.sh
new file mode 100644
index 0000000..a2cf5fb
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.sh
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+REGRESSION_START($1)
+
+echo '1..24'
+
+REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
+REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
+REGRESSION_TEST(`f', `printf "%f,%-8.3f,%f,%f\n" +42.25 -42.25 inf nan')
+REGRESSION_TEST(`l1', `LC_ALL=en_US.ISO8859-1 printf "%d\n" $(printf \"\\344)')
+REGRESSION_TEST(`l2', `LC_ALL=en_US.UTF-8 printf "%d\n" $(printf \"\\303\\244)')
+REGRESSION_TEST(`m1', `printf "%c%%%d\0\045\n" abc \"abc')
+REGRESSION_TEST(`m2', `printf "abc\n\cdef"')
+REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl')
+REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
+REGRESSION_TEST(`m5', `printf -- "-d\n"')
+REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
+REGRESSION_TEST('zero', `printf "%u%u\n" 15')
+REGRESSION_TEST('zero', `printf "%d%d\n" 15')
+REGRESSION_TEST('zero', `printf "%d%u\n" 15')
+REGRESSION_TEST('zero', `printf "%u%d\n" 15')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*s" 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$s" 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*.*1\$s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
+REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
+REGRESSION_TEST(`bwidth', `printf "%8.2b" "a\nb\n"')
+
+REGRESSION_END()
diff --git a/shell_cmds/printf/tests/regress.zero.out b/shell_cmds/printf/tests/regress.zero.out
new file mode 100644
index 0000000..fa8f08c
--- /dev/null
+++ b/shell_cmds/printf/tests/regress.zero.out
@@ -0,0 +1 @@
+150