diff --git a/S32-str/sprintf.t b/S32-str/sprintf.t index 9daf0b2647..2405962f79 100644 --- a/S32-str/sprintf.t +++ b/S32-str/sprintf.t @@ -2,7 +2,7 @@ use v6; use Test; -plan 128; +plan 135; # L @@ -204,11 +204,28 @@ is sprintf('%s', -Inf), -Inf, 'sprintf %s handles Inf'; is sprintf('%d %1$x %1$o', 12), '12 c 14', 'positional argument specifier $'; -# RT #74610 -dies_ok {sprintf "%s"}, 'missing sprintf string argument'; - # RT 117547 is sprintf('%10s', "☃" x 3), ' ☃☃☃', 'multi-byte characters are counted correctly for %Ns strings'; +is sprintf("%x %x", 301281685344656640, 301281685344656669), '42e5e18b84c9d00 42e5e18b84c9d1d', 'RT #118601'; +is sprintf("%d", 42**20), '291733167875766667063796853374976', 'RT #118253'; +is map({chars sprintf "[%18s]\n", "ಠ" x $_ }, 0..6), [21, 21, 21, 21, 21, 21, 21], 'RT #117547'; +is Date.new(-13_000_000_000, 1, 1), '-13000000000-01-01', 'RT #114760'; + +# RT #116280 +{ + #?rakudo.parrot todo "sprintf printf numbers before NaN" + #?rakudo.jvm 3 skip "java.lang.NumberFormatException" + is sprintf('%12.5f', NaN), ' NaN', 'RT #116280'; + #?rakudo.parrot 2 skip "sprintf hangs when printing Inf/-Inf" + is sprintf('%12.5f', Inf), ' Inf', 'RT #116280'; + is sprintf('%12.5f', -Inf), ' -Inf', 'RT #116280'; +} + +# RT #106594, #62316, #74610 +{ + try sprintf("%d-%s", 42); + is $!, 'Too many directives: found 2, but only 1 arguments after the format string', 'RT #106594, #62316, #74610'; +} # vim: ft=perl6