summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-28 14:00:56 +0100
committerNicholas Clark <nick@ccl4.org>2012-02-28 22:08:28 +0100
commit1ef1b534951078128b3ff9ad272aed49b0809053 (patch)
tree6f85f837e84134cc7cf0c3b78d331ee2382ba43d
parentf428f17372790d940a2db364ead107ae60a6c096 (diff)
downloadperl-1ef1b534951078128b3ff9ad272aed49b0809053.tar.gz
Avoid deparse.t testing everything under use feature ':5.10'
Only use feature ':5.10' in those tests that actually need it. This will let us add tests for deparsing without any features enabled.
-rw-r--r--dist/B-Deparse/t/deparse.t44
1 files changed, 36 insertions, 8 deletions
diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t
index f606479b92..de7f1a710d 100644
--- a/dist/B-Deparse/t/deparse.t
+++ b/dist/B-Deparse/t/deparse.t
@@ -11,14 +11,7 @@ BEGIN {
use warnings;
use strict;
-BEGIN {
- # BEGIN block is actually a subroutine :-)
- return unless $] > 5.009;
- require feature;
- feature->import(':5.10');
-}
use Test::More;
-use Config ();
my $tests = 17; # not counting those in the __DATA__ section
@@ -460,20 +453,24 @@ our @bar;
foo { @bar } 1 xor foo();
####
# SKIP ?$] < 5.010 && "say not implemented on this Perl version"
+# CONTEXT use feature ':5.10';
# say
say 'foo';
####
# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
+# CONTEXT use feature ':5.10';
# state vars
state $x = 42;
####
# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
+# CONTEXT use feature ':5.10';
# state var assignment
{
my $y = (state $x = 42);
}
####
# SKIP ?$] < 5.010 && "state vars not implemented on this Perl version"
+# CONTEXT use feature ':5.10';
# state vars in anonymous subroutines
$a = sub {
state $x;
@@ -498,6 +495,7 @@ my $c = [];
my $d = \[];
####
# SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl version"
+# CONTEXT use feature ':5.10';
# implicit smartmatch in given/when
given ('foo') {
when ('bar') { continue; }
@@ -857,7 +855,6 @@ my @a;
$a[0] = 1;
####
# feature features without feature
-no feature 'say', 'state', 'switch';
CORE::state $x;
CORE::say $x;
CORE::given ($x) {
@@ -888,6 +885,37 @@ CORE::given ($x) {
CORE::evalbytes '';
() = CORE::__SUB__;
>>>>
+CORE::state $x;
+CORE::say $x;
+CORE::given ($x) {
+ CORE::when (3) {
+ continue;
+ }
+ CORE::default {
+ CORE::break;
+ }
+}
+CORE::evalbytes '';
+() = CORE::__SUB__;
+####
+# (the above test with CONTEXT, and the output is equivalent but different)
+# CONTEXT use feature ':5.10';
+# feature features when feature has been disabled by use VERSION
+use feature (sprintf(":%vd", $^V));
+use 1;
+CORE::state $x;
+CORE::say $x;
+CORE::given ($x) {
+ CORE::when (3) {
+ continue;
+ }
+ CORE::default {
+ CORE::break;
+ }
+}
+CORE::evalbytes '';
+() = CORE::__SUB__;
+>>>>
no feature;
use feature ':default';
CORE::state $x;