diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-06 21:59:17 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-08 12:24:50 -0700 |
commit | 2c658e55bf9e8acf7cc0207ea3db8f7064cb3ad7 (patch) | |
tree | 7e24c397b7a2afdff20bc984cf995353fc1d9d7f /t | |
parent | a33a81d07c9c0cb0ab9ba85fab5a519c4b3b710b (diff) | |
download | perl-2c658e55bf9e8acf7cc0207ea3db8f7064cb3ad7.tar.gz |
Don’t create formats after compilation errors
Otherwise you can end up with a format that has nonsensical op tree,
but it gets attached and you can call it anyway.
Diffstat (limited to 't')
-rw-r--r-- | t/op/write.t | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/t/op/write.t b/t/op/write.t index 60ae9b3426..090fc4f31e 100644 --- a/t/op/write.t +++ b/t/op/write.t @@ -61,7 +61,7 @@ for my $tref ( @NumTests ){ my $bas_tests = 21; # number of tests in section 3 -my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96 + 5; +my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96 + 6; # number of tests in section 4 my $hmb_tests = 35; @@ -1047,6 +1047,17 @@ write NEST; close NEST or die "Could not close: $!"; is cat('Op_write.tmp'), "birds\nnest\n", 'nested formats'; +# A compilation error should not create a format +eval q| +format ERROR = +@ +@_ =~ s/// +. +|; +eval { write ERROR }; +like $@, qr'Undefined format', + 'formats with compilation errors are not created'; + ############################# ## Section 4 |