diff options
author | David Mitchell <davem@iabyn.com> | 2012-06-04 14:32:55 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-06-13 13:32:55 +0100 |
commit | 86464c5bd354edcd6bbed4d8f1a4acf44b522066 (patch) | |
tree | a36492d94cbc7c8cd55480d5de159e0c5413d052 | |
parent | 497d0a962eb278e5235610fab370cb59f4a5d7c4 (diff) | |
download | perl-86464c5bd354edcd6bbed4d8f1a4acf44b522066.tar.gz |
add tests that (?{}) etc called in scalar context
-rw-r--r-- | t/re/pat_re_eval.t | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/t/re/pat_re_eval.t b/t/re/pat_re_eval.t index f158f85beb..22a1ec9a5a 100644 --- a/t/re/pat_re_eval.t +++ b/t/re/pat_re_eval.t @@ -23,7 +23,7 @@ BEGIN { } -plan tests => 448; # Update this when adding/deleting tests. +plan tests => 452; # Update this when adding/deleting tests. run_tests() unless caller; @@ -966,6 +966,16 @@ sub run_tests { like($warn, qr/value \$u1 in pattern match.*\n.*value at/, 'uninit'); } + # test that code blocks are called in scalar context + + { + my @a = (0); + ok("" =~ /^(?{@a})$/, '(?{}) in scalar context'); + is($^R, 1, '(?{}) in scalar context: $^R'); + ok("1" =~ /^(??{@a})$/, '(??{}) in scalar context'); + ok("foo" =~ /^(?(?{@a})foo|bar)$/, '(?(?{})|) in scalar context'); + } + } # End of sub run_tests |