diff options
author | eadler <eadler@FreeBSD.org> | 2012-12-18 21:02:38 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2012-12-18 21:02:38 +0000 |
commit | 0c8af40857c82fc7e7b484dcd6d85076583109ea (patch) | |
tree | 9ecfe92a175b4198b319072ba6b3848aaeb69e2c /tools/regression/usr.bin | |
parent | fcd944ca59586f9936bdb0c0bb82712869544a37 (diff) | |
download | FreeBSD-src-0c8af40857c82fc7e7b484dcd6d85076583109ea.zip FreeBSD-src-0c8af40857c82fc7e7b484dcd6d85076583109ea.tar.gz |
POSIX requires that non-existent or null arguments be treated as if a
zero argument were supplied.
Add a regression test to catch this case as well.
PR: bin/174521
Submitted by: Daniel Shahaf <danielsh@elego.de> (pr)
Submitted by: Mark Johnston <markjdb@gmail.com> (initial patch)
Reviewed by: jilles
Approved by: cperciva (implicit)
MFC after: 3 weeks
Diffstat (limited to 'tools/regression/usr.bin')
-rw-r--r-- | tools/regression/usr.bin/printf/regress.sh | 3 | ||||
-rw-r--r-- | tools/regression/usr.bin/printf/regress.zero.out | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/regression/usr.bin/printf/regress.sh b/tools/regression/usr.bin/printf/regress.sh index 4ce282f..9df7e3e 100644 --- a/tools/regression/usr.bin/printf/regress.sh +++ b/tools/regression/usr.bin/printf/regress.sh @@ -2,7 +2,7 @@ REGRESSION_START($1) -echo '1..11' +echo '1..12' 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') @@ -15,5 +15,6 @@ 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_END() diff --git a/tools/regression/usr.bin/printf/regress.zero.out b/tools/regression/usr.bin/printf/regress.zero.out new file mode 100644 index 0000000..fa8f08c --- /dev/null +++ b/tools/regression/usr.bin/printf/regress.zero.out @@ -0,0 +1 @@ +150 |