Open leonerd opened 5 years ago
Test case:
#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
BEGIN {
plan skip_all => "Syntax::Keyword::Gather >= 1.000 is not available"
unless eval { require Syntax::Keyword::Gather;
Syntax::Keyword::Gather->VERSION( '1.000' ) };
plan skip_all => "Syntax::Keyword::Try >= 0.07 is not available"
unless eval { require Syntax::Keyword::Try;
Syntax::Keyword::Try->VERSION( '0.07' ) };
Syntax::Keyword::Gather->import;
Syntax::Keyword::Try->import;
diag( "Syntax::Keyword::Gather $Syntax::Keyword::Gather::VERSION, " .
"Syntax::Keyword::Try $Syntax::Keyword::Try::VERSION" );
}
# take inside try
{
my @gathered = gather {
take 1;
try {
take 2;
}
catch { }
take 3;
};
is_deeply( \@gathered, [ 1 .. 3 ],
'take inside try'
);
}
# take inside catch
{
my @gathered = gather {
take 4;
try {
die "Oopsie";
}
catch {
take 5;
}
take 6;
};
is_deeply( \@gathered, [ 4 .. 6 ],
'take inside catch'
);
}
done_testing;
Yields output:
t/80gather+try.t ....... # Syntax::Keyword::Gather 1.003002, Syntax::Keyword::Try 0.09_001t/80gather+try.t ....... 1/?
# Failed test 'take inside try'
# at t/80gather+try.t line 33.
# Structures begin differing at:
# $got->[1] = '3'
# $expected->[1] = '2'
# Looks like you failed 1 test of 2.
t/80gather+try.t ....... Dubious, test returned 1 (wstat 256, 0x100)
I've been testing out pairs of syntax-extension modules, and I have encountered the case that
Syntax::Keyword::Gather
+Syntax::Keyword::Try
don't quite interact properly.A
take
inside atry
block appears to go unnoticed. Oddly though,take
insidecatch
works fine.I'm unsure yet if it's an issue with SKG or SKT, but I thought I'd report here so you're aware.