require './test.pl';
}
-plan tests => 275;
+plan tests => 280;
is(
sprintf("%.40g ",0.01),
sprintf("%.40f", 0.01)." ",
q(the sprintf "%.<number>f" optimization)
);
-{
- chop(my $utf8_format = "%-3s\x{100}");
- is(
- sprintf($utf8_format, "\xe4"),
- "\xe4 ",
- q(width calculation under utf8 upgrade)
- );
+
+# cases of $i > 1 are against [perl #39126]
+for my $i (1, 5, 10, 20, 50, 100) {
+ chop(my $utf8_format = "%-*s\x{100}");
+ my $string = "\xB4"x$i; # latin1 ACUTE or ebcdic COPYRIGHT
+ my $expect = $string." "x$i; # followed by 2*$i spaces
+ is(sprintf($utf8_format, 3*$i, $string), $expect,
+ "width calculation under utf8 upgrade, length=$i");
}
# Used to mangle PL_sv_undef