- my $display_call = "is${function}$suffix("
- . " $display_name )$display_locale";
- $ret = truth eval "test_is${function}$suffix('$char')";
- if (is ($@, "", "$display_call didn't give error")) {
+ foreach my $utf8_param("_safe",
+ "_safe, malformed",
+ "deprecated unsafe"
+ )
+ {
+ my $utf8_param_code = $utf8_param_code{$utf8_param};
+ my $expect_error = $utf8_param_code > 0;
+ next if $expect_error
+ && ! try_malforming($i, $function,
+ $suffix =~ /LC/);
+
+ my $display_call = "is${function}$suffix( $display_name"
+ . ", $utf8_param )$display_locale";
+ $ret = truth eval "test_is${function}$suffix('$char',"
+ . " $utf8_param_code)";
+ if ($expect_error) {
+ isnt ($@, "",
+ "expected and got error in $display_call");
+ like($@, qr/Malformed UTF-8 character/,
+ "${tab}And got expected message");
+ if (is (@warnings, 1,
+ "${tab}Got a single warning besides"))
+ {
+ like($warnings[0],
+ qr/Malformed UTF-8 character.*short/,
+ "${tab}Got expected warning");
+ }
+ else {
+ diag("@warnings");
+ }
+ undef @warnings;
+ }
+ elsif (is ($@, "", "$display_call didn't give error")) {