. '"';
}
+sub output_warnings(@) {
+ diag "The warnings were:\n" . join("", @_);
+}
+
# This test file can't use byte_utf8a_to_utf8n() from t/charset_tools.pl
# because that uses the same functions we are testing here. So UTF-EBCDIC
# strings are hard-coded as I8 strings in this file instead, and we use array
unless (is(scalar @warnings, 0,
" Verify is_utf8_valid_partial_char_flags generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
my $b = substr($n_chr, $j, 1);
unless (is(scalar @warnings, 0,
"Verify utf8n_to_uvchr() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR_flags() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR_flags() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isSTRICT_UTF8_CHAR() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isSTRICT_UTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isC9_STRICT_UTF8_CHAR() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isC9_STRICT_UTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify isUTF8_CHAR() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"Verify valid_utf8_to_uvchr() for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
# Similarly for uvchr_to_utf8
unless (is(scalar @warnings, 0,
"Verify uvchr_to_utf8_flags($hex_n, $display_flags) for $hex_n generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
# Now append this code point to a string that we will test various
unless (is(scalar @warnings, 0,
"$testname: isUTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"$testname: isUTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
$ret = test_isSTRICT_UTF8_CHAR($bytes, $length);
unless (is(scalar @warnings, 0,
"$testname: isSTRICT_UTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
$ret = test_isC9_STRICT_UTF8_CHAR($bytes, $length);
unless (is(scalar @warnings, 0,
"$testname: isC9_STRICT_UTF8_CHAR() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
for my $j (1 .. $length - 1) {
unless (is(scalar @warnings, 0,
"$testname: is_utf8_valid_partial_char_flags() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
}
else {
if (scalar @warnings) {
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
is($ret_ref->[0], 0, "$testname: utf8n_to_uvchr(), disallowed: no warnings 'utf8': Returns 0");
is($ret_ref->[1], $expected_len, "$testname: utf8n_to_uvchr(), disallowed: no warnings 'utf8': Returns expected length: $expected_len");
if (!is(scalar @warnings, 0, "$testname: utf8n_to_uvchr(), disallowed: no warnings 'utf8': no warnings generated")) {
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
is($ret_ref->[0], 0, "$testname: CHECK_ONLY: Returns 0");
is($ret_ref->[1], -1, "$testname: CHECK_ONLY: returns -1 for length");
if (! is(scalar @warnings, 0, "$testname: CHECK_ONLY: no warnings generated")) {
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
next if $allow_flags == 0; # Skip if can't allow this malformation
is($ret_ref->[1], $expected_len, "$testname: utf8n_to_uvchr(), allowed: Returns expected length: $expected_len");
if (!is(scalar @warnings, 0, "$testname: utf8n_to_uvchr(), allowed: no warnings generated"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
unless (is(scalar @warnings, 0,
"isUTF8_CHAR() and isUTF8_CHAR()_flags $testname: generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"isSTRICT_UTF8_CHAR() and isUTF8_CHAR_flags $testname: generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
undef @warnings;
unless (is(scalar @warnings, 0,
"isC9_STRICT_UTF8_CHAR() and isUTF8_CHAR_flags $testname: generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
# Test partial character handling, for each byte not a full character
unless (is(scalar @warnings, 0,
"$testname: is_utf8_valid_partial_char_flags() generated no warnings"))
{
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
}
"$this_name: No warnings generated"))
{
diag $call;
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
elsif ($will_overflow
}
else {
diag $call;
- if (scalar @warnings) {
- diag "The warnings were: "
- . join(", ", @warnings);
- }
+ output_warnings(@warnings) if scalar @warnings;
}
}
elsif ($warn_flag
else {
diag $call;
if (scalar @warnings) {
- diag "The warnings were: "
- . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
}
"$this_name, CHECK_ONLY: no warnings generated"))
{
diag $call;
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
"$this_name: No warnings generated"))
{
diag $call;
- diag "The warnings were: " . join(", ", @warnings);
+ output_warnings(@warnings);
}
}
elsif ($uvchr_warn_flag
}
else {
diag $call;
- if (scalar @warnings) {
- diag "The warnings were: "
- . join(", ", @warnings);
- }
+ output_warnings(@warnings) if scalar @warnings;
}
}
}