diff options
author | David Mitchell <davem@iabyn.com> | 2012-02-16 15:53:50 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-06-13 13:32:48 +0100 |
commit | fbf5ab7b5c4e456459cd9fe59d022d6dbf9fe991 (patch) | |
tree | 101d0615fdb876c10f5093126047a9ea973633fc /t/re | |
parent | 1e8a3b2152353363351e69c589d0f60e4c8bfb49 (diff) | |
download | perl-fbf5ab7b5c4e456459cd9fe59d022d6dbf9fe991.tar.gz |
re/pat_re_eval.t: tidy some 'use re eval' tests
reduce the scope of 'use re eval' to the barest minimum;
I also discovered while doing this that one block had the use; ... no;
swapped, and this didn't die, so I've added a TODO test.
Diffstat (limited to 't/re')
-rw-r--r-- | t/re/pat_re_eval.t | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/t/re/pat_re_eval.t b/t/re/pat_re_eval.t index 0290bc1585..a650b6a24c 100644 --- a/t/re/pat_re_eval.t +++ b/t/re/pat_re_eval.t @@ -22,7 +22,7 @@ BEGIN { } -plan tests => 252; # Update this when adding/deleting tests. +plan tests => 255; # Update this when adding/deleting tests. run_tests() unless caller; @@ -431,9 +431,10 @@ sub run_tests { # literal qr code only created once, embedded with text + run code - use re 'eval'; $cr4 //= qr/C(??{$x})$/; my $code3 = 'A(??{$x})'; + + use re 'eval'; ok("A$x-BCa" =~ /^$code3-B$cr4/, "[$x] literal qr once embedded text + run code"); no re 'eval'; @@ -456,17 +457,26 @@ sub run_tests { # literal qr code, embedded with text + run code - no re 'eval'; my $r4 = qr/C(??{$x})$/; my $code4 = '(??{$x})'; + + use re 'eval'; ok("A$x-BC$x" =~ /^A$code4-B$r4/, "[$x] literal qr embedded text + run code"); - use re 'eval'; + no re 'eval'; + + { + local $::TODO = 're_eval not yet secure!!'; + eval { "A$x-BC$x" =~ /^A$code4-B$r4/ }; + like($@, qr/Eval-group not allowed/, "runtime code5"); + } + # nested qr in different scopes my $code5 = '(??{$x})'; my $r5 = qr/C(??{$x})/; + use re 'eval'; my $r6 = qr/$code5-C(??{$x})/; no re 'eval'; |