This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
update experimental to 0.024 from CPAN
[perl5.git] / cpan / experimental / t / basic.t
index adfc566..248b56c 100644 (file)
@@ -5,6 +5,8 @@ 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) {
@@ -17,45 +19,26 @@ END
 }
 
 if ($] >= 5.010001) {
-       if (eval '
-               no warnings "experimental";
-               use feature "switch";
-               if(0) { when(3) {} }
-               1;
-       ') {
-               is (eval <<'END', 1, 'switch compiles') or diag $@;
-               use experimental 'switch';
-               sub bar { 1 };
-               given(1) {
-                       when (\&bar) {
-                               pass("bar matches 1");
-                       }
-                       default {
-                               fail("bar matches 1");
-                       }
+       is (eval <<'END', 1, 'switch compiles') or diag $@;
+       use experimental 'switch';
+       sub bar { 1 };
+       given(1) {
+               when (\&bar) {
+                       pass("bar matches 1");
                }
-               1;
-END
-       } else {
-               is (eval <<'END', 1, 'switch compiles') or diag $@;
-               use experimental 'switch';
-               sub bar { 1 };
-               given(1) {
-                       whereso (\&bar) {
-                               pass("bar matches 1");
-                       }
+               default {
                        fail("bar matches 1");
                }
-               1;
-END
        }
+       1;
+END
 }
 
 if ($] >= 5.010001) {
        is (eval <<'END', 1, 'smartmatch compiles') or diag $@;
        use experimental 'smartmatch';
-       { package Baz; use overload "~~" => sub { 1 }; }
-       is(1 ~~ bless({}, "Baz"), 1, "is 1");
+       sub baz { 1 };
+       is(1 ~~ \&baz, 1, "is 1");
        1;
 END
 }
@@ -69,7 +52,16 @@ if ($] >= 5.018) {
 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);