diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-02 17:15:19 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-03-02 17:15:19 +0000 |
commit | 3044771b5a0b1fa685d8045d8d413aa97613b0a5 (patch) | |
tree | fbdfa91d09ddcd085759b9f8390a5b71857b66e1 /t/re/pat.t | |
parent | 5da2a9e66f07aa4d2d451438340ee61e50f01bc1 (diff) | |
download | perl-3044771b5a0b1fa685d8045d8d413aa97613b0a5.tar.gz |
Simplify pat.t by removing a loop over 2 items, which is mostly if/else
Diffstat (limited to 't/re/pat.t')
-rw-r--r-- | t/re/pat.t | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/t/re/pat.t b/t/re/pat.t index f8df68c96f..5e78ce74b6 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -442,18 +442,22 @@ sub run_tests { eval { /(?$code)/ }; ok $@ && $@ =~ /not allowed at runtime/ && $blah == 12; - for $code ('{$blah = 45}','=xx') { - $blah = 12; - my $res = eval { "xx" =~ /(?$code)/o }; - no warnings 'uninitialized'; + $blah = 12; + my $res = eval { "xx" =~ /(?$code)/o }; + { + no warnings 'uninitialized'; + local $Error = "'$@', '$res', '$blah'"; + ok $@ && $@ =~ /not allowed at runtime/ && $blah == 12; + } + + $code = '=xx'; + $blah = 12; + $res = eval { "xx" =~ /(?$code)/o }; + { + no warnings 'uninitialized'; local $Error = "'$@', '$res', '$blah'"; - if ($code eq '=xx') { - ok !$@ && $res; - } - else { - ok $@ && $@ =~ /not allowed at runtime/ && $blah == 12; - } - } + ok !$@ && $res; + } $code = '{$blah = 45}'; $blah = 12; |