summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-28 16:44:51 +0100
committerNicholas Clark <nick@ccl4.org>2012-03-19 10:21:54 +0100
commit8f57bb34632c3884eb14455ddf9dcb86975886af (patch)
treecdce39c53fa5eee0cbcbb3770bc16c2507d13d25
parent205fef8800760e59c00e57b4e56a9851113e96cb (diff)
downloadperl-8f57bb34632c3884eb14455ddf9dcb86975886af.tar.gz
Add tests for deparsing C<say> under various combinations of pragmas.
These mostly codify the current output of B::Deparse, which is not invalid, but might not be considered to be the optimal output. (It's defensive, in that it uses C<no feature;> which will ensure consistent behaviour whatever pragma context the output is evaluated in.) Some are TODO for the cases where B::Deparse is wrongly outputting C<CORE::say> instead of plain C<say> and C<CORE::__SUB__> instead of plain C<__SUB__>.
-rw-r--r--dist/B-Deparse/t/deparse.t91
1 files changed, 91 insertions, 0 deletions
diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t
index de7f1a710d..1861fd2486 100644
--- a/dist/B-Deparse/t/deparse.t
+++ b/dist/B-Deparse/t/deparse.t
@@ -457,6 +457,97 @@ foo { @bar } 1 xor foo();
# say
say 'foo';
####
+# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::say
+# CONTEXT use 5.10.0;
+# say in the context of use 5.10.0
+say 'foo';
+####
+# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::say
+# say with use 5.10.0
+use 5.10.0;
+say 'foo';
+>>>>
+no feature;
+use feature ':5.10';
+say 'foo';
+####
+# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# say with use feature ':5.10';
+use feature ':5.10';
+say 'foo';
+>>>>
+use feature 'say', 'state', 'switch';
+say 'foo';
+####
+# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::say
+# CONTEXT use feature ':5.10';
+# say with use 5.10.0 in the context of use feature
+use 5.10.0;
+say 'foo';
+>>>>
+no feature;
+use feature ':5.10';
+say 'foo';
+####
+# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# CONTEXT use 5.10.0;
+# say with use feature ':5.10' in the context of use 5.10.0
+use feature ':5.10';
+say 'foo';
+>>>>
+say 'foo';
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# CONTEXT use feature ':5.15';
+# __SUB__
+__SUB__;
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::__SUB__
+# CONTEXT use 5.15.0;
+# __SUB__ in the context of use 5.15.0
+__SUB__;
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::__SUB__
+# __SUB__ with use 5.15.0
+use 5.15.0;
+__SUB__;
+>>>>
+no feature;
+use feature ':5.16';
+__SUB__;
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# __SUB__ with use feature ':5.15';
+use feature ':5.15';
+__SUB__;
+>>>>
+use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval';
+__SUB__;
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# TODO B::Deparse outputs CORE::__SUB__
+# CONTEXT use feature ':5.15';
+# __SUB__ with use 5.15.0 in the context of use feature
+use 5.15.0;
+__SUB__;
+>>>>
+no feature;
+use feature ':5.16';
+__SUB__;
+####
+# SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version"
+# CONTEXT use 5.15.0;
+# __SUB__ with use feature ':5.15' in the context of use 5.15.0
+use feature ':5.15';
+__SUB__;
+>>>>
+__SUB__;
+####
# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
# CONTEXT use feature ':5.10';
# state vars