Print this page
4854 printf(1) doesn't support %b and \c properly
*** 25,35 ****
print "TEST PASS: ${1}"
}
test_fail() {
print "TEST FAIL: ${1}: ${2}"
! # exit -1
}
checkrv() {
if [[ $? -ne 0 ]]; then
test_fail $1 "exit failure"
--- 25,35 ----
print "TEST PASS: ${1}"
}
test_fail() {
print "TEST FAIL: ${1}: ${2}"
! exit -1
}
checkrv() {
if [[ $? -ne 0 ]]; then
test_fail $1 "exit failure"
*** 141,164 ****
tests[15][desc]="embedded octal escape"
tests[15][format]='%s\41%s'
tests[15][args]="one two"
tests[15][result]='one!two'
! # this is not yet supported
! #typeset -A tests[16]=()
! #tests[16][desc]="backslash string (%b)"
! #tests[16][format]='%b'
! #tests[16][args]='\0101\0102\0103'
! #tests[16][result]='ABC'
! # nor is this
! #typeset -A tests[17]=()
! #tests[17][desc]="backslash c in %b"
! #tests[17][format]='%b%s'
! #tests[17][args]='\0101\cone two'
! #tests[17][result]='A'
#debug=yes
for i in "${!tests[@]}"; do
t=test_$i
desc=${tests[$i][desc]}
--- 141,180 ----
tests[15][desc]="embedded octal escape"
tests[15][format]='%s\41%s'
tests[15][args]="one two"
tests[15][result]='one!two'
! typeset -A tests[16]=()
! tests[16][desc]="backslash string (%b)"
! tests[16][format]='%b'
! tests[16][args]='\0101\0102\0103'
! tests[16][result]='ABC'
! typeset -A tests[17]=()
! tests[17][desc]="backslash c in %b"
! tests[17][format]='%b%s'
! tests[17][args]='\0101\cone two'
! tests[17][result]='A'
+ typeset -A tests[18]=()
+ tests[18][desc]="backslash octal in format"
+ tests[18][format]='HI\1120K\0112tabbed\11again'
+ tests[18][args]=
+ tests[18][result]='HIJ0K 2tabbed again'
+
+ typeset -A tests[19]=()
+ tests[19][desc]="backslash octal in %b"
+ tests[19][format]="%b"
+ tests[19][args]='HI\0112K\011tabbed'
+ tests[19][result]='HIJK tabbed'
+
+ typeset -A tests[20]=()
+ tests[20][desc]="numeric %d and ASCII conversions"
+ tests[20][format]='%d '
+ tests[20][args]="3 +3 -3 \"3 \"+ '-"
+ tests[20][result]='3 3 -3 51 43 45 '
+
#debug=yes
for i in "${!tests[@]}"; do
t=test_$i
desc=${tests[$i][desc]}