Results for builtin-printf.test.sh

statusdashbashmkshzshashosh
pass 264126282529
ok 122315
N-I 1501410158
BUG 101220
FAIL 000001
total434343434343
casedashbashmkshzshashoshdescription
0pass pass ok ok pass pass printf with no args
detailsdetails
1N-I pass N-I N-I N-I pass printf -v %s
detailsdetailsdetailsdetails
2N-I pass N-I N-I N-I pass printf -v %q
detailsdetailsdetailsdetails
3N-I pass N-I N-I N-I pass printf -v a[1]
detailsdetailsdetailsdetails
4pass pass N-I N-I N-I pass printf -v syntax error
detailsdetailsdetails
5N-I pass N-I pass N-I pass dynamic declare instead of %s
detailsdetailsdetails
6N-I pass N-I N-I N-I ok dynamic declare instead of %q
detailsdetailsdetailsdetailsdetails
7N-I pass N-I N-I N-I ok printf -v dynamic scope
detailsdetailsdetailsdetailsdetails
8pass pass pass pass pass pass printf with too few arguments
9pass pass pass pass pass pass printf with too many arguments
10pass pass pass pass pass pass printf width strings
11pass pass pass pass pass pass printf integer
12pass pass pass pass pass N-I printf %6.4d -- precision means something different for integers !?
details
13pass pass pass pass pass pass printf %6.4s does both truncation and padding
14pass pass N-I pass pass pass printf %6.0s and %0.0s
details
15pass pass N-I BUG pass pass printf %6.s and %0.s
detailsdetails
16pass pass pass pass pass pass printf %*.*s (width/precision from args)
17pass pass pass pass pass pass unsigned / octal / hex
18pass pass pass pass ok ok empty string (osh is more strict)
detailsdetails
19pass pass ok pass pass pass No char after ' (osh is more strict)
details
20BUG pass BUG pass BUG FAIL Unicode char with ' (osh is more strict)
detailsdetailsdetailsdetails
21pass pass pass pass pass N-I negative numbers with unsigned / octal / hex
details
22pass pass pass pass pass N-I printf floating point (not required, but they all implement it)
details
23pass pass pass pass pass N-I printf floating point with - and 0
details
24pass pass pass pass pass N-I printf eE fF gG
details
25N-I pass pass pass pass pass printf backslash escapes
details
26pass pass pass pass pass pass printf octal backslash escapes
27N-I pass pass pass N-I pass printf unicode backslash escapes
detailsdetails
28pass pass pass pass pass pass printf invalid backslash escape (is ignored)
29pass pass pass pass pass pass printf % escapes
30pass pass pass pass pass pass printf %b backslash escaping
31pass pass pass pass pass pass printf %b with \c early return
32N-I pass pass pass N-I N-I printf %c -- doesn't respect UTF-8! Bad.
detailsdetailsdetails
33ok pass pass pass pass ok printf invalid format
detailsdetails
34N-I ok pass ok N-I pass printf %q
detailsdetailsdetailsdetails
35N-I ok N-I ok N-I pass printf %6q (width)
detailsdetailsdetailsdetailsdetails
36pass pass pass pass pass N-I printf + and space flags
details
37pass pass pass pass pass N-I printf # flag
details
38pass pass pass BUG BUG ok Runtime error for invalid integer
detailsdetailsdetails
39N-I pass N-I N-I N-I pass %(strftime format)T
detailsdetailsdetailsdetails
40N-I pass N-I N-I N-I pass %(strftime format)T doesn't respect TZ if not exported
detailsdetailsdetailsdetails
41N-I pass N-I N-I N-I pass %(strftime format)T TZ in environ but not in shell's memory
detailsdetailsdetailsdetails
42N-I pass N-I N-I N-I pass %10.5(strftime format)T
detailsdetailsdetailsdetails
175 passed, 14 OK, 62 not implemented, 6 BUG, 1 failed, 0 timeouts, 0 cases skipped
1 failed under osh

Details on runs that didn't PASS

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:
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: 
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: 
dash: 1: shopt: not found
dash: 2: Syntax error: "(" unexpected
mksh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
mksh: <stdin>[1]: shopt: not found
printf: warning: ignoring excess arguments, starting with ‘a[1]’
zsh3 printf -v a[1]

stdout:
-vstatus=0
['a', 'b', 'c']
stderr:
zsh: command not found: shopt
ash3 printf -v a[1]

stdout:
stderr: 
ash: shopt: not found
ash: syntax error: unexpected "("
mksh4 printf -v syntax error

stdout:
-vstatus=0
stderr:
mksh: <stdin>[1]: shopt: not found
printf: warning: ignoring excess arguments, starting with ‘a[’
zsh4 printf -v syntax error

stdout:
-vstatus=0
stderr:
zsh: command not found: shopt
ash4 printf -v syntax error

stdout:
-vstatus=0
stderr:
ash: shopt: not found
dash5 dynamic declare instead of %s

stdout:
['']
stderr:
dash: 2: declare: not found
mksh5 dynamic declare instead of %s

stdout:
['']
stderr:
mksh: <stdin>[2]: declare: not found
ash5 dynamic declare instead of %s

stdout:
['']
stderr:
ash: declare: not found
dash6 dynamic declare instead of %q

stdout:
stderr: 
dash: 3: Bad substitution
mksh6 dynamic declare instead of %q

stdout:
stderr: 
mksh: <stdin>[3]: declare: not found
zsh6 dynamic declare instead of %q

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

stdout:
stderr: 
ash: syntax error: bad substitution
osh6 dynamic declare instead of %q

stdout:
$'"quoted" with spaces and \\'
stderr:
dash7 printf -v dynamic scope

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

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

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

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

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

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

stdout:
[      ]
[
stderr:
printf: %0.0s: invalid conversion specification
mksh15 printf %6.s and %0.s

stdout:
[      ]
[
stderr:
printf: %0.s: invalid conversion specification
zsh15 printf %6.s and %0.s

stdout:
[   foo]
[foo]
stderr:
ash18 empty string (osh is more strict)

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

stdout:
stderr: 
  printf '%d\n' ''
                ^
[ stdin ]:1: printf expected an integer, got ''
mksh19 No char after ' (osh is more strict)

stdout:
0
0
stderr:
printf: ‘'’: expected a numeric value
printf: ‘"’: expected a numeric value
dash20 Unicode char with ' (osh is more strict)

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

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

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

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

stdout:
ce
stderr:
osh21 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
osh22 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
osh23 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: Expected a printf format character
  [%08.04f]\n
        ^
(source.ArgvWord word_spid:48):1: Expected a 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: osh printf doesn't support floating point
  [%-8.04f]\n
        ^
(source.ArgvWord word_spid:98):1: Expected a printf format character
  [%-08.04f]\n
         ^
(source.ArgvWord word_spid:113):1: Expected a printf format character
osh24 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
dash25 printf backslash escapes

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

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

stdout:
['\\u2620']
['\\U0000065f']
stderr:
dash32 printf %c -- doesn't respect UTF-8! Bad.

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

stdout:
[\u03bc\u03bc]
1
stderr:
osh32 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)
dash33 printf invalid format

stdout:
status=2
status=2
stderr:
dash: 1: printf: %z: invalid directive
dash: 3: printf: %-z: invalid directive
osh33 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
dash34 printf %q

stdout:
[
stderr:
dash: 2: printf: %q: invalid directive
bash34 printf %q

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

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

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

stdout:
[
stderr:
dash: 2: printf: %6q: invalid directive
bash35 printf %6q (width)

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

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

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

stdout:
[
stderr:
ash: %6q]\n: invalid format
osh36 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:13):1: osh printf doesn't support the '+' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:24):1: osh printf doesn't support the ' ' flag
  [% d]\n
    ^
(source.ArgvWord word_spid:35):1: osh printf doesn't support the ' ' flag
osh37 printf # flag

stdout:
---
stderr:
  [%#o][%#o]\n
    ^
(source.ArgvWord word_spid:2):1: osh printf doesn't support the '#' flag
  [%#x][%#x]\n
    ^
(source.ArgvWord word_spid:15):1: osh printf doesn't support the '#' flag
  [%#X][%#X]\n
    ^
(source.ArgvWord word_spid:28):1: osh printf doesn't support the '#' flag
  [%.0f][%#.0f]\n
      ^
(source.ArgvWord word_spid:45):1: osh printf doesn't support floating point
  [%g][%#g]\n
    ^
(source.ArgvWord word_spid:60):1: osh printf doesn't support floating point
zsh38 Runtime error for invalid integer

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

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

stdout:
status=1
status=1
stderr:
  printf '%d\n' $x
                ^~
[ stdin ]:2: printf expected an integer, got '3abc'
  printf '%d\n' xyz
                ^~~
[ stdin ]:4: printf expected an integer, got 'xyz'
dash39 %(strftime format)T

stdout:
status=2
stderr:
dash: 2: printf: %(: invalid directive
dash: 4: printf: %(: invalid directive
mksh39 %(strftime format)T

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

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

stdout:
status=1
stderr:
ash: %(%Y-%m-%d)T\n: invalid format
ash: %(%Y-%m-%d)T\n: invalid format
dash40 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
dash: 2: printf: %(: invalid directive
dash: 4: printf: %(: invalid directive
mksh40 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
printf: %(: invalid conversion specification
printf: %(: invalid conversion specification
zsh40 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
printf: %(: invalid directive
printf: %(: invalid directive
ash40 %(strftime format)T doesn't respect TZ if not exported

stdout:
stderr: 
ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format
ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format
dash41 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
dash: 2: printf: %(: invalid directive
dash: 4: printf: %(: invalid directive
mksh41 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
printf: %(: invalid conversion specification
printf: %(: invalid conversion specification
zsh41 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
printf: %(: invalid directive
printf: %(: invalid directive
ash41 %(strftime format)T TZ in environ but not in shell's memory

stdout:
stderr: 
ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format
ash: %(%Y-%m-%d %H:%M:%S)T\n: invalid format
dash42 %10.5(strftime format)T

stdout:
[[status=2
stderr:
dash: 2: printf: %10.5(: invalid directive
dash: 4: printf: %10.5(: invalid directive
mksh42 %10.5(strftime format)T

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

stdout:
[[status=1
stderr:
printf: %10.5(: invalid directive
printf: %10.5(: invalid directive
ash42 %10.5(strftime format)T

stdout:
[[status=1
stderr:
ash: %10.5(%Y-%m-%d)T]\n: invalid format
ash: %10.5(%Y-%m-%d)T]\n: invalid format