#! perl
+use strict;
+use warnings;
+
use Test::More 0.89;
+plan skip_all => 'This module is a no-op on perls earlier than 5.010' if "$]" < 5.010000;
+
local $SIG{__WARN__} = sub { fail("Got unexpected warning"); diag($_[0]) };
if ($] >= 5.010000) {
- is (eval <<'END', 1, 'lexical topic compiles') or diag $@;
- use experimental 'lexical_topic';
- my $_ = 1;
- is($_, 1, '$_ is 1');
+ is (eval <<'END', 1, 'state compiles') or diag $@;
+ use experimental 'state';
+ state $foo = 1;
+ is($foo, 1, '$foo is 1');
1;
END
}
-else {
- fail("No experimental features available on perl $]");
-}
if ($] >= 5.010001) {
is (eval <<'END', 1, 'switch compiles') or diag $@;
if ($] >= 5.010001) {
is (eval <<'END', 1, 'smartmatch compiles') or diag $@;
use experimental 'smartmatch';
- sub bar { 1 };
- is(1 ~~ \&bar, 1, "is 1");
+ sub baz { 1 };
+ is(1 ~~ \&baz, 1, "is 1");
1;
END
}
END
}
-if ($] >= 5.021005) {
+if ($] >= 5.026000) {
+ is (eval <<'END', 1, 'declared refs compiles') or diag $@;
+ use experimental 'declared_refs';
+ my @b;
+ my \@a = \@b;
+ is(\@a, \@b, '@a and @b are the same after \@a=\@b');
+ 1;
+END
+}
+elsif ($] >= 5.021005) {
is (eval <<'END', 1, 'ref aliasing compiles') or diag $@;
use experimental 'refaliasing';
+ my (@a, @b);
\@a = \@b;
is(\@a, \@b, '@a and @b are the same after \@a=\@b');
1;