diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-25 20:15:36 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-07-25 22:08:32 -0700 |
commit | 9a0c99494cbbb7d1253332ab4ce0581e90f707a7 (patch) | |
tree | 98ceb547aaaadfecdcf45c59bb9c4b582f4af588 /t/comp | |
parent | 8777c9be0f45ac3c917698c1afb18e1e8507a188 (diff) | |
download | perl-9a0c99494cbbb7d1253332ab4ce0581e90f707a7.tar.gz |
Don’t let ?: folding affect stat
stat(${\1} ? foo : bar) and stat(1 ? foo : bar) should behave the same
way, but were treated differently, due to the way ?: is folded in
the latter case. Now that foldedness is recorded in the op tree
(cc2ebcd7902), we can use the OPpCONST_FOLDED flag to distinguish
stat(1 ? foo : bar) from stat(foo).
Diffstat (limited to 't/comp')
-rw-r--r-- | t/comp/fold.t | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/t/comp/fold.t b/t/comp/fold.t index 69d1903a43..c600067542 100644 --- a/t/comp/fold.t +++ b/t/comp/fold.t @@ -4,7 +4,7 @@ # we've not yet verified that use works. # use strict; -print "1..23\n"; +print "1..25\n"; my $test = 0; # Historically constant folding was performed by evaluating the ops, and if @@ -132,3 +132,10 @@ package other { # hide the "ok" sub print " ", ++$test, " - print followed by const || URSINE\n"; BEGIN { $^W = 1 } } + +# or stat +print "not " unless stat(1 ? INSTALL : 0) eq stat("INSTALL"); +print "ok ", ++$test, " - stat(const ? word : ....)\n"; +# in case we are in t/ +print "not " unless stat(1 ? TEST : 0) eq stat("TEST"); +print "ok ", ++$test, " - stat(const ? word : ....)\n"; |