]> git.saurik.com Git - apple/shell_cmds.git/blob - printf/tests/regress.sh
shell_cmds-203.tar.gz
[apple/shell_cmds.git] / printf / tests / regress.sh
1 # $FreeBSD: head/usr.bin/printf/tests/regress.sh 266854 2014-05-29 19:48:18Z pfg $
2
3 enable -n printf
4
5 REGRESSION_START($1)
6
7 echo '1..23'
8
9 REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
10 REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
11 REGRESSION_TEST(`f', `printf "%f,%-8.3f,%f,%f\n" +42.25 -42.25 inf nan')
12 REGRESSION_TEST(`l1', `LC_ALL=en_US.ISO8859-1 printf "%d\n" $(printf \"\\344)')
13 REGRESSION_TEST(`l2', `LC_ALL=en_US.UTF-8 printf "%d\n" $(printf \"\\303\\244)')
14 REGRESSION_TEST(`m1', `printf "%c%%%d\0\045\n" abc \"abc')
15 REGRESSION_TEST(`m2', `printf "abc\n\cdef"')
16 REGRESSION_TEST(`m3', `printf "%%%s\n" abc def ghi jkl')
17 REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
18 REGRESSION_TEST(`m5', `printf -- "-d\n"')
19 REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
20 REGRESSION_TEST('zero', `printf "%u%u\n" 15')
21 REGRESSION_TEST('zero', `printf "%d%d\n" 15')
22 REGRESSION_TEST('zero', `printf "%d%u\n" 15')
23 REGRESSION_TEST('zero', `printf "%u%d\n" 15')
24 REGRESSION_TEST(`missingpos1', `printf "%1\$*s" 1 1 2>&1')
25 REGRESSION_TEST(`missingpos1', `printf "%*1\$s" 1 1 2>&1')
26 REGRESSION_TEST(`missingpos1', `printf "%1\$*.*s" 1 1 1 2>&1')
27 REGRESSION_TEST(`missingpos1', `printf "%*1\$.*s" 1 1 1 2>&1')
28 REGRESSION_TEST(`missingpos1', `printf "%*.*1\$s" 1 1 1 2>&1')
29 REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1')
30 REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1')
31 REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1')
32
33 REGRESSION_END()