Subject: | test_bugs_3.22 #46 fails under locale |
Summary:
Test #46 in test_bugs_3.22 from XML::Twig 3.23 fails when running under
non-English locale due to comparisons with hardcoded error messages in
English.
Failure:
t/test_bugs_3.22....................NOK 46unsupported encoding:
expected to match /^(Unsupported encoding: a_non_existent_encoding_
bwaaahhh|Text::Iconv not available|Can't locate)/, got 'Unsupported
conversion: Das Argument ist ungültig at (eval 17) line 3.
BEGIN failed--compilation aborted at (eval 17) line 5.
at t/test_bugs_3.22.t line 113
'
t/test_bugs_3.22....................FAILED test 46
Configuration:
perl: 5.008007
OS: linux - i686-linux
XML::Parser : 2.34 (required)
expat : 1.95.8 (required)
Scalar::Util : 1.18 (for improved memory
management)
Encode : 2.15 (for encoding conversions)
LWP : 5.805 (for the parseurl method)
HTML::Entities : 1.35 (for the html_encode filter)
Tie::IxHash : 1.21 (for the keep_atts_order
option)
XML::XPath : 1.13 (to use XML::Twig::XPath)
HTML::TreeBuilder : 3.13 (to use parse_html and
parsefile_html)
Text::Wrap : 2005.0824 (to use the "wrapped"
option for pretty_print)
Test : 1.25 (for testing purposes)
Test::Pod : 1.24 (for testing purposes)
XML::Simple : 2.14 (for testing purposes)
XML::Handler::YAWriter : 0.23 (for testing purposes)
XML::SAX::Writer : <not available> (for testing purposes)
XML::Filter::BufferText : 1.01 (for testing purposes)
IO::Scalar : 2.110 (for testing purposes)
localhost:> perl -v|head -2
This is perl, v5.8.7 built for i586-linux-thread-multi
localhost:> uname -a
Linux localhost 2.6.13-15.8-default #1 Tue Feb 7 11:07:24 UTC 2006 i686
athlon i386 GNU/Linux
localhost:> locale|head -1
LANG=de_DE.UTF-8
localhost:> iconv --version|head -1
iconv (GNU libc) 2.3.5
localhost:> perl -MText::Iconv -e'print"$Text::Iconv::VERSION\n"'
1.4
The patch for the test:
localhost:> diff -u test_bugs_3.22.t.old test_bugs_3.22.t
--- test_bugs_3.22.t.old 2006-01-23 11:42:58.000000000 +0100
+++ test_bugs_3.22.t 2006-05-04 20:40:16.000000000 +0200
@@ -111,7 +111,7 @@
{ my $enc= "a_non_existent_encoding_bwaaahhh";
eval { XML::Twig->iconv_convert( $enc); };
- matches( $@, "^(Unsupported encoding: $enc|Text::Iconv not available|
Can't locate)", "unsupported encoding");
+ matches( $@, "^(Unsupported encoding: $enc|Text::Iconv not available|
Can't locate|Unsupported conversion)", "unsupported encoding");
}
{ # test comments handlers
Patch for Twig.pm so that the intention of a more accurate error
message is kept:
localhost:> diff -u Twig.pm.old Twig.pm
--- Twig.pm.old 2006-01-23 15:22:13.000000000 +0100
+++ Twig.pm 2006-05-04 20:59:48.000000000 +0200
@@ -3668,7 +3668,7 @@
}
};
unless( $sub)
- { if( $@=~ m{^Unsupported conversion: Invalid argument})
+ { if( $@=~ m{^Unsupported conversion: })
{ croak "Unsupported encoding: $enc"; }
else
{ croak $@; }