1#! perl 2 3use Test::More 0.89; 4 5local $SIG{__WARN__} = sub { fail("Got unexpected warning"); diag($_[0]) }; 6 7if ($] >= 5.010000) { 8 is (eval <<'END', 1, 'lexical topic compiles') or diag $@; 9 use experimental 'lexical_topic'; 10 my $_ = 1; 11 is($_, 1, '$_ is 1'); 12END 13} 14else { 15 fail("No experimental features available on perl $]"); 16} 17 18if ($] >= 5.010001) { 19 is (eval <<'END', 1, 'smartmatch compiles') or diag $@; 20 use experimental 'smartmatch'; 21 sub bar { 1 }; 22 is(1 ~~ \&bar, 1, "is 1"); 23END 24} 25 26if ($] >= 5.018) { 27 is (eval <<'END', 1, 'lexical subs compiles') or diag $@; 28 use experimental 'lexical_subs'; 29 my sub foo { 1 }; 30 is(foo(), 1, "foo is 1"); 31 1; 32END 33} 34 35done_testing; 36 37