Results for builtin-printf.test.sh

statusdashbashmkshzshashoshosh_ALT
pass 22342426221919
ok 1223155
N-I 12096111111
BUG 1011200
FAIL 0000011
total36363636363636
casedashbashmkshzshashoshosh_ALTdescription
0ok pass ok ok pass pass pass printf with no args
detailsdetailsdetails
1N-I pass N-I N-I N-I pass pass printf -v %s
detailsdetailsdetailsdetails
2N-I pass N-I N-I N-I pass pass printf -v %q
detailsdetailsdetailsdetails
3N-I pass N-I N-I N-I N-I N-I printf -v a[1]
detailsdetailsdetailsdetailsdetailsdetails
4N-I pass N-I pass N-I pass pass dynamic declare instead of %s
detailsdetailsdetails
5N-I pass N-I N-I N-I pass pass dynamic declare instead of %q
detailsdetailsdetailsdetails
6N-I pass N-I N-I N-I ok ok printf -v dynamic scope
detailsdetailsdetailsdetailsdetailsdetails
7pass pass pass pass pass pass pass printf with too few arguments
8pass pass pass pass pass pass pass printf with too many arguments
9pass pass pass pass pass pass pass printf width strings
10pass pass pass pass pass pass pass printf integer
11pass pass pass pass pass N-I N-I printf %6.4d -- precision means something different for integers !?
detailsdetails
12pass pass pass pass pass pass pass printf %6.4s does both truncation and padding
13pass pass N-I pass pass pass pass printf %6.0s and %0.0s
details
14pass pass pass pass pass pass pass unsigned / octal / hex
15pass pass pass pass ok ok ok empty string (osh is more strict)
detailsdetailsdetails
16pass pass ok pass pass ok ok No char after ' (osh is more strict)
detailsdetailsdetails
17BUG pass BUG pass BUG FAIL FAIL Unicode char with ' (osh is more strict)
detailsdetailsdetailsdetailsdetails
18pass pass pass pass pass N-I N-I negative numbers with unsigned / octal / hex
detailsdetails
19pass pass pass pass pass N-I N-I printf floating point (not required, but they all implement it)
detailsdetails
20pass pass pass pass pass N-I N-I printf floating point with - and 0
detailsdetails
21pass pass pass pass pass N-I N-I printf eE fF gG
detailsdetails
22N-I pass pass pass pass pass pass printf backslash escapes
details
23pass pass pass pass pass pass pass printf octal backslash escapes
24N-I pass pass pass N-I pass pass printf unicode backslash escapes
detailsdetails
25pass pass pass pass pass pass pass printf invalid backslash escape (is ignored)
26pass pass pass pass pass pass pass printf % escapes
27pass pass pass pass pass N-I N-I printf %b backslash escaping
detailsdetails
28N-I pass pass pass N-I N-I N-I printf %c -- doesn't respect UTF-8! Bad.
detailsdetailsdetailsdetails
29pass pass pass pass pass ok ok printf invalid format
detailsdetails
30N-I ok pass ok N-I pass pass printf %q
detailsdetailsdetailsdetails
31N-I ok N-I ok N-I pass pass printf %6q (width)
detailsdetailsdetailsdetailsdetails
32pass pass pass pass pass N-I N-I printf + and space flags
detailsdetails
33pass pass pass pass pass N-I N-I printf # flag
detailsdetails
34pass pass pass BUG BUG ok ok Runtime error for invalid integer
detailsdetailsdetailsdetails
35N-I pass N-I N-I N-I N-I N-I %(strftime format)T
detailsdetailsdetailsdetailsdetailsdetails
166 passed, 19 OK, 60 not implemented, 5 BUG, 1 failed, 0 timeouts, 0 cases skipped
1 failed under osh

Details on runs that didn't PASS

dash0 printf with no args

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 1: printf: usage: printf format [arg ...]
mksh0 printf with no args

stdout:
stderr: 
printf: missing operand
Try 'printf --help' for more information.
zsh0 printf with no args

stdout:
stderr: 
printf: not enough arguments
dash1 printf -v %s

stdout:
['']
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 2: printf: Illegal option -v
mksh1 printf -v %s

stdout:
-v['']
stderr:
printf: warning: ignoring excess arguments, starting with ‘foo’
zsh1 printf -v %s

stdout:
-v['']
stderr:
ash1 printf -v %s

stdout:
-v['']
stderr:
dash2 printf -v %q

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 2: printf: Illegal option -v
mksh2 printf -v %q

stdout:
-v
stderr:
printf: warning: ignoring excess arguments, starting with ‘foo’
zsh2 printf -v %q

stdout:
-v
stderr:
ash2 printf -v %q

stdout:
-v
stderr:
dash3 printf -v a[1]

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 1: Syntax error: "(" unexpected
mksh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
printf: warning: ignoring excess arguments, starting with ‘a[1]’
zsh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
ash3 printf -v a[1]

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/ash: syntax error: unexpected "("
osh3 printf -v a[1]

stdout:
status=2
['a', 'b', 'c']
stderr:
  printf -v 'a[1]' %s 'foo'
  ^~~~~~
[ stdin ]:2: 'printf' got invalid variable name 'a[1]'
osh_ALT3 printf -v a[1]

stdout:
status=2
['a', 'b', 'c']
stderr:
  printf -v 'a[1]' %s 'foo'
  ^~~~~~
[ stdin ]:2: 'printf' got invalid variable name 'a[1]'
dash4 dynamic declare instead of %s

stdout:
['']
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 2: declare: not found
mksh4 dynamic declare instead of %s

stdout:
['']
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[2]: declare: not found
ash4 dynamic declare instead of %s

stdout:
['']
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/ash: declare: not found
dash5 dynamic declare instead of %q

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 3: Bad substitution
mksh5 dynamic declare instead of %q

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[3]: declare: not found
zsh5 dynamic declare instead of %q

stdout:
stderr: 
zsh: bad substitution
ash5 dynamic declare instead of %q

stdout:
stderr: 
/home/andy/git/oilshell/oil/_tmp/spec-bin/ash: syntax error: bad substitution
dash6 printf -v dynamic scope

stdout:
not implemented
stderr:
mksh6 printf -v dynamic scope

stdout:
not implemented
stderr:
zsh6 printf -v dynamic scope

stdout:
not implemented
stderr:
ash6 printf -v dynamic scope

stdout:
not implemented
stderr:
osh6 printf -v dynamic scope

stdout:
dollar=dollar
--
dollar='$'
mylocal='mylocal'
--
dollar='$'
mylocal=
stderr:
osh_ALT6 printf -v dynamic scope

stdout:
dollar=dollar
--
dollar='$'
mylocal='mylocal'
--
dollar='$'
mylocal=
stderr:
osh11 printf %6.4d -- precision means something different for integers !?

stdout:
stderr: 
  [%6.4d]\n
      ^
(source.ArgvWord word_spid:2):1: precision can't be specified when here
osh_ALT11 printf %6.4d -- precision means something different for integers !?

stdout:
stderr: 
  [%6.4d]\n
      ^
(source.ArgvWord word_spid:2):1: precision can't be specified when here
mksh13 printf %6.0s and %0.0s

stdout:
[      ]
[
stderr:
printf: %0.0s: invalid conversion specification
ash15 empty string (osh is more strict)

stdout:
0
stderr:
ash: invalid number ''
osh15 empty string (osh is more strict)

stdout:
stderr: 
  printf '%d\n' ''
                ^
[ stdin ]:1: printf got invalid number ''
osh_ALT15 empty string (osh is more strict)

stdout:
stderr: 
  printf '%d\n' ''
                ^
[ stdin ]:1: printf got invalid number ''
mksh16 No char after ' (osh is more strict)

stdout:
0
stderr:
printf: ‘'’: expected a numeric value
osh16 No char after ' (osh is more strict)

stdout:
stderr: 
  printf '%d\n' \'
                ^~
[ stdin ]:1: printf got invalid number "'"
osh_ALT16 No char after ' (osh is more strict)

stdout:
stderr: 
  printf '%d\n' \'
                ^~
[ stdin ]:1: printf got invalid number "'"
dash17 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
mksh17 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
'printf: warning: \xbc: character(s) following character constant have been ignored\n'
ash17 Unicode char with ' (osh is more strict)

stdout:
ce
stderr:
osh17 Unicode char with ' (osh is more strict)

[osh stdout] Expected '3bc\n', got 'ce\n'

stdout:
ce
stderr:
osh_ALT17 Unicode char with ' (osh is more strict)

[osh_ALT stdout] Expected '3bc\n', got 'ce\n'

stdout:
ce
stderr:
osh18 negative numbers with unsigned / octal / hex

stdout:
stderr: 
  [%u]\n
    ^
(source.ArgvWord word_spid:2):1: fatal: Can't format negative number -42 with %u
osh_ALT18 negative numbers with unsigned / octal / hex

stdout:
stderr: 
  [%u]\n
    ^
(source.ArgvWord word_spid:2):1: fatal: Can't format negative number -42 with %u
osh19 printf floating point (not required, but they all implement it)

stdout:
stderr: 
  [%f]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%.2f]\n
      ^
(source.ArgvWord word_spid:13):1: osh printf doesn't support floating point
  [%8.2f]\n
       ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support floating point
  [%-8.2f]\n
        ^
(source.ArgvWord word_spid:40):1: osh printf doesn't support floating point
  [%-f]\n
     ^
(source.ArgvWord word_spid:55):1: osh printf doesn't support floating point
  [%-f]\n
     ^
(source.ArgvWord word_spid:67):1: osh printf doesn't support floating point
osh_ALT19 printf floating point (not required, but they all implement it)

stdout:
stderr: 
  [%f]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%.2f]\n
      ^
(source.ArgvWord word_spid:13):1: osh printf doesn't support floating point
  [%8.2f]\n
       ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support floating point
  [%-8.2f]\n
        ^
(source.ArgvWord word_spid:40):1: osh printf doesn't support floating point
  [%-f]\n
     ^
(source.ArgvWord word_spid:55):1: osh printf doesn't support floating point
  [%-f]\n
     ^
(source.ArgvWord word_spid:67):1: osh printf doesn't support floating point
osh20 printf floating point with - and 0

stdout:
---
stderr:
  [%8.4f]\n
       ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%08.4f]\n
        ^
(source.ArgvWord word_spid:16):1: osh printf doesn't support floating point
  [%8.04f]\n
       ^
(source.ArgvWord word_spid:31):1: Invalid printf format character
  [%08.04f]\n
        ^
(source.ArgvWord word_spid:48):1: Invalid printf format character
  [%-8.4f]\n
        ^
(source.ArgvWord word_spid:67):1: osh printf doesn't support floating point
  [%-08.4f]\n
     ^
(source.ArgvWord word_spid:82):1: Invalid printf format character
  [%-8.04f]\n
        ^
(source.ArgvWord word_spid:94):1: Invalid printf format character
  [%-08.04f]\n
     ^
(source.ArgvWord word_spid:109):1: Invalid printf format character
osh_ALT20 printf floating point with - and 0

stdout:
---
stderr:
  [%8.4f]\n
       ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%08.4f]\n
        ^
(source.ArgvWord word_spid:16):1: osh printf doesn't support floating point
  [%8.04f]\n
       ^
(source.ArgvWord word_spid:31):1: Invalid printf format character
  [%08.04f]\n
        ^
(source.ArgvWord word_spid:48):1: Invalid printf format character
  [%-8.4f]\n
        ^
(source.ArgvWord word_spid:67):1: osh printf doesn't support floating point
  [%-08.4f]\n
     ^
(source.ArgvWord word_spid:82):1: Invalid printf format character
  [%-8.04f]\n
        ^
(source.ArgvWord word_spid:94):1: Invalid printf format character
  [%-08.04f]\n
     ^
(source.ArgvWord word_spid:109):1: Invalid printf format character
osh21 printf eE fF gG

stdout:
stderr: 
  [%e]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%E]\n
    ^
(source.ArgvWord word_spid:13):1: osh printf doesn't support floating point
  [%f]\n
    ^
(source.ArgvWord word_spid:24):1: osh printf doesn't support floating point
  [%g]\n
    ^
(source.ArgvWord word_spid:35):1: osh printf doesn't support floating point
  [%G]\n
    ^
(source.ArgvWord word_spid:46):1: osh printf doesn't support floating point
osh_ALT21 printf eE fF gG

stdout:
stderr: 
  [%e]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support floating point
  [%E]\n
    ^
(source.ArgvWord word_spid:13):1: osh printf doesn't support floating point
  [%f]\n
    ^
(source.ArgvWord word_spid:24):1: osh printf doesn't support floating point
  [%g]\n
    ^
(source.ArgvWord word_spid:35):1: osh printf doesn't support floating point
  [%G]\n
    ^
(source.ArgvWord word_spid:46):1: osh printf doesn't support floating point
dash22 printf backslash escapes

stdout:
['a\tb']
['\\xE2\\x98\\xA0']
['$e']
['\x1f7']
stderr:
dash24 printf unicode backslash escapes

stdout:
['\\u2620']
['\\U0000065f']
stderr:
ash24 printf unicode backslash escapes

stdout:
['\\u2620']
['\\U0000065f']
stderr:
osh27 printf %b backslash escaping

stdout:
[\044]
status=2
stderr:
  [%b]\n
    ^
(source.ArgvWord word_spid:21):1: osh printf doesn't support backslash escaping (try $'\n')
osh_ALT27 printf %b backslash escaping

stdout:
[\044]
status=2
stderr:
  [%b]\n
    ^
(source.ArgvWord word_spid:21):1: osh printf doesn't support backslash escaping (try $'\n')
dash28 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[$\u03bc\u03bc]
1
stderr:
ash28 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[\u03bc\u03bc]
1
stderr:
osh28 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[μμ]
0
stderr:
  %c
   ^
(source.ArgvWord word_spid:24):1: osh printf doesn't support single characters (bytes)
osh_ALT28 printf %c -- doesn't respect UTF-8! Bad.

stdout:
[μμ]
0
stderr:
  %c
   ^
(source.ArgvWord word_spid:24):1: osh printf doesn't support single characters (bytes)
osh29 printf invalid format

stdout:
status=2
status=2
stderr:
  %z
   ^
(source.ArgvWord word_spid:2):1: Invalid printf format character
  %-z
    ^
(source.ArgvWord word_spid:17):1: Invalid printf format character
osh_ALT29 printf invalid format

stdout:
status=2
status=2
stderr:
  %z
   ^
(source.ArgvWord word_spid:2):1: Invalid printf format character
  %-z
    ^
(source.ArgvWord word_spid:17):1: Invalid printf format character
dash30 printf %q

stdout:
[
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 2: printf: %q: invalid directive
bash30 printf %q

stdout:
[a\ b]
stderr:
zsh30 printf %q

stdout:
[a\ b]
stderr:
ash30 printf %q

stdout:
[
stderr:
ash: %q]\n: invalid format
dash31 printf %6q (width)

stdout:
[
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 2: printf: %6q: invalid directive
bash31 printf %6q (width)

stdout:
[  a\ b]
stderr:
mksh31 printf %6q (width)

stdout:
[
stderr:
printf: %6q: invalid conversion specification
zsh31 printf %6q (width)

stdout:
[  a\ b]
stderr:
ash31 printf %6q (width)

stdout:
[
stderr:
ash: %6q]\n: invalid format
osh32 printf + and space flags

stdout:
stderr: 
  [%+d]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support the '+' flag
  [%+d]\n
    ^
(source.ArgvWord word_spid:14):1: osh printf doesn't support the '+' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support the ' ' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:38):1: osh printf doesn't support the ' ' flag
osh_ALT32 printf + and space flags

stdout:
stderr: 
  [%+d]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support the '+' flag
  [%+d]\n
    ^
(source.ArgvWord word_spid:14):1: osh printf doesn't support the '+' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support the ' ' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:38):1: osh printf doesn't support the ' ' flag
osh33 printf # flag

stdout:
---
stderr:
  [%#o]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support the '#' flag
  [%#x]\n
    ^
(source.ArgvWord word_spid:14):1: osh printf doesn't support the '#' flag
  [%#X]\n
    ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support the '#' flag
  [%#f]\n
    ^
(source.ArgvWord word_spid:42):1: osh printf doesn't support the '#' flag
osh_ALT33 printf # flag

stdout:
---
stderr:
  [%#o]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support the '#' flag
  [%#x]\n
    ^
(source.ArgvWord word_spid:14):1: osh printf doesn't support the '#' flag
  [%#X]\n
    ^
(source.ArgvWord word_spid:26):1: osh printf doesn't support the '#' flag
  [%#f]\n
    ^
(source.ArgvWord word_spid:42):1: osh printf doesn't support the '#' flag
zsh34 Runtime error for invalid integer

stdout:
0
status=1
0
status=0
stderr:
zsh: bad math expression: operator expected at `abc'
ash34 Runtime error for invalid integer

stdout:
0
status=1
0
status=1
stderr:
ash: invalid number '3abc'
ash: invalid number 'xyz'
osh34 Runtime error for invalid integer

stdout:
status=1
status=1
stderr:
  printf '%d\n' $x
                ^~
[ stdin ]:2: printf got invalid number '3abc'
  printf '%d\n' xyz
                ^~~
[ stdin ]:4: printf got invalid number 'xyz'
osh_ALT34 Runtime error for invalid integer

stdout:
status=1
status=1
stderr:
  printf '%d\n' $x
                ^~
[ stdin ]:2: printf got invalid number '3abc'
  printf '%d\n' xyz
                ^~~
[ stdin ]:4: printf got invalid number 'xyz'
dash35 %(strftime format)T

stdout:
status=1
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/dash: 1: printf: %(: invalid directive
mksh35 %(strftime format)T

stdout:
status=1
stderr:
printf: %(: invalid conversion specification
zsh35 %(strftime format)T

stdout:
status=1
stderr:
printf: %(: invalid directive
ash35 %(strftime format)T

stdout:
status=1
stderr:
ash: %(%Y-%m-%d)T\n: invalid format
osh35 %(strftime format)T

stdout:
status=2
stderr:
  %(%Y-%m-%d)T\n
   ^
(source.ArgvWord word_spid:2):1: Invalid printf format character
osh_ALT35 %(strftime format)T

stdout:
status=2
stderr:
  %(%Y-%m-%d)T\n
   ^
(source.ArgvWord word_spid:2):1: Invalid printf format character