From: Vincent Pit Date: Mon, 16 Aug 2010 15:47:48 +0000 (+0200) Subject: Yet more quotelike tests X-Git-Tag: v0.22~1 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=commitdiff_plain;h=f136bf535929d8e3d552f0e1c28e44bcc7b5c006 Yet more quotelike tests --- diff --git a/t/20-good.t b/t/20-good.t index 85f1900..b360431 100644 --- a/t/20-good.t +++ b/t/20-good.t @@ -9,7 +9,7 @@ package main; use strict; use warnings; -use Test::More tests => 86 * 8; +use Test::More tests => 101 * 8; BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} } @@ -253,17 +253,47 @@ s/foo/return; Hlagh->$meth/e; #### # local $_ = "bar"; s/foo/return; Hlagh->$meth/e; #### # local $_ = "foo"; -s/foo/return; $pkg->new/e; +s/foo/return; $x->new/e; #### # local $_ = "bar"; -s/foo/return; $pkg->new/e; +s/foo/return; $x->new/e; #### # local $_ = "foo"; -s/foo/return; $pkg->$cb/e; +s/foo/return; $x->$cb/e; #### # local $_ = "bar"; -s/foo/return; $pkg->$cb/e; +s/foo/return; $x->$cb/e; #### # local $_ = "foo"; -s/foo/return; $pkg->$meth/e; +s/foo/return; $x->$meth/e; #### # local $_ = "bar"; -s/foo/return; $pkg->$meth/e; +s/foo/return; $x->$meth/e; +#### # local $_ = "foo"; +s/foo/return; $y->new/e; +#### # local $_ = "bar"; +s/foo/return; $y->new/e; +#### # local $_ = "foo"; +s/foo/return; $y->$cb/e; +#### # local $_ = "bar"; +s/foo/return; $y->$cb/e; +#### # local $_ = "foo"; +s/foo/return; $y->$meth/e; +#### # local $_ = "bar"; +s/foo/return; $y->$meth/e; +#### +"foo" =~ /(?{Hlagh->new})/; +#### +"foo" =~ /(?{Hlagh->$cb})/; +#### +"foo" =~ /(?{Hlagh->$meth})/; +#### +"foo" =~ /(?{$x->new})/; +#### +"foo" =~ /(?{$x->$cb})/; +#### +"foo" =~ /(?{$x->$meth})/; +#### +"foo" =~ /(?{$y->new})/; +#### +"foo" =~ /(?{$y->$cb})/; +#### +"foo" =~ /(?{$y->$meth})/; #### exec $x $x, @a; #### diff --git a/t/21-bad.t b/t/21-bad.t index abdd7d3..5984ef0 100644 --- a/t/21-bad.t +++ b/t/21-bad.t @@ -11,8 +11,8 @@ use warnings; my ($tests, $reports); BEGIN { - $tests = 76; - $reports = 88; + $tests = 82; + $reports = 94; } use Test::More tests => 3 * (4 * $tests + $reports) + 4; @@ -31,8 +31,8 @@ sub expect { my ($meth, $obj, $file, $line) = @$_; $meth = quotemeta $meth; $obj = ($obj =~ /^\s*\{/) ? "a block" : "object \"\Q$obj\E\""; - $file = '\(eval \d+\)' unless defined $file; - $line = '\d+' unless defined $line; + $file = '\((?:re_)?eval \d+\)' unless defined $file; + $line = '\d+' unless defined $line; qr/^Indirect call of method "$meth" on $obj at $file line $line/ } eval $expected; } @@ -427,6 +427,30 @@ s/foo/return; new $y/e; ---- [ 'new', '$y' ] #### +"foo" =~ /(?{new Hlagh})/; +---- +[ 'new', 'Hlagh' ] +#### +"foo" =~ /(?{new $x})/; +---- +[ 'new', '$x' ] +#### +"foo" =~ /(?{new $y})/; +---- +[ 'new', '$y' ] +#### +"foo" =~ /(??{new Hlagh})/; +---- +[ 'new', 'Hlagh' ] +#### +"foo" =~ /(??{new $x})/; +---- +[ 'new', '$x' ] +#### +"foo" =~ /(??{new $y})/; +---- +[ 'new', '$y' ] +#### meh { }; ---- [ 'meh', '{' ]