use lib './lib';
use Test::More tests => 3;
use strict;
# Test for RT#17325
BEGIN { use_ok('XML::Stream', 'Parser'); }
my @test_strings = (
{
xml => q[awayAway],
message => 'one double quote',
},
{
xml => q[awayAway],
message => 'one single quote',
}
);
foreach my $test_string ( @test_strings ) {
my $p = XML::Stream::Parser->new();
my $return;
my $message = $test_string->{'message'};
# The nature of the bug which this test aims to prove is such that an
# infinite loop is caused on failure, hence this timeout code
eval {
local $SIG{ALRM} = sub { die "TIMED OUT\n" };
alarm 3;
$return = $p->parse( $test_string->{'xml'} );
} or do {
$return = '';
$message .= ' - ' . $@;
};
isa_ok ( $return, 'ARRAY', $message );
}