summaryrefslogtreecommitdiff
path: root/tests/misc/printf.sh
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-07-04 17:13:50 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-07-04 17:13:50 +0300
commit71cd8e3a743046573744123777061b64881bf372 (patch)
tree82522befe647f4fff186a5630cad0cad33f8ef53 /tests/misc/printf.sh
parentc18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff)
downloadcoreutils-upstream.tar.gz
Imported Upstream version 8.24upstream/8.24upstream
Diffstat (limited to 'tests/misc/printf.sh')
-rwxr-xr-xtests/misc/printf.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/misc/printf.sh b/tests/misc/printf.sh
index b2292252..87ca489f 100755
--- a/tests/misc/printf.sh
+++ b/tests/misc/printf.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# basic tests for printf
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# Copyright (C) 2002-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -25,7 +25,9 @@ getlimits_
# Verify the 3 methods of specifying "Escape":
-test $($prog "\x1b\n\33\n\e\n" | uniq -u) && fail=1
+printf '%s\n' . . . | tr . '\033' > exp
+$prog '\x1b\n\33\n\e\n' > out || fail=1
+compare exp out || fail=1
# This would fail (by printing the '--') for printf in sh-utils
# and in coreutils 4.5.1.
@@ -68,17 +70,17 @@ $prog '8 %b %b %b %b\n' '\1y' '\01y' '\001y' '\0001y'|tr '\1' = >> out
$prog '9 %*dx\n' -2 0 >>out || fail=1
$prog '10 %.*dx\n' $INT_UFLOW 0 >>out || fail=1
-$prog '%.*dx\n' $INT_OFLOW 0 >>out 2> /dev/null && fail=1
+returns_ 1 $prog '%.*dx\n' $INT_OFLOW 0 >>out 2> /dev/null || fail=1
$prog '11 %*c\n' 2 x >>out || fail=1
-$prog '%#d\n' 0 >>out 2> /dev/null && fail=1
+returns_ 1 $prog '%#d\n' 0 >>out 2> /dev/null || fail=1
-$prog '%0s\n' 0 >>out 2> /dev/null && fail=1
+returns_ 1 $prog '%0s\n' 0 >>out 2> /dev/null || fail=1
-$prog '%.9c\n' 0 >>out 2> /dev/null && fail=1
+returns_ 1 $prog '%.9c\n' 0 >>out 2> /dev/null || fail=1
-$prog '%'\''s\n' 0 >>out 2> /dev/null && fail=1
+returns_ 1 $prog '%'\''s\n' 0 >>out 2> /dev/null || fail=1
cat <<\EOF > exp
1 x y