Commit | Line | Data |
---|---|---|
de84ff2b RS |
1 | #! perl |
2 | ||
3 | use Test::More 0.89; | |
4 | ||
5 | local $SIG{__WARN__} = sub { fail("Got unexpected warning"); diag($_[0]) }; | |
6 | ||
7 | if ($] >= 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'); | |
f8c3bb9c | 12 | 1; |
de84ff2b RS |
13 | END |
14 | } | |
15 | else { | |
16 | fail("No experimental features available on perl $]"); | |
17 | } | |
18 | ||
19 | if ($] >= 5.010001) { | |
f8c3bb9c CBW |
20 | is (eval <<'END', 1, 'switch compiles') or diag $@; |
21 | use experimental 'switch'; | |
22 | sub bar { 1 }; | |
23 | given(1) { | |
24 | when (\&bar) { | |
25 | pass("bar matches 1"); | |
26 | } | |
27 | default { | |
28 | fail("bar matches 1"); | |
29 | } | |
30 | } | |
31 | 1; | |
32 | END | |
33 | } | |
34 | ||
35 | if ($] >= 5.010001) { | |
de84ff2b RS |
36 | is (eval <<'END', 1, 'smartmatch compiles') or diag $@; |
37 | use experimental 'smartmatch'; | |
38 | sub bar { 1 }; | |
39 | is(1 ~~ \&bar, 1, "is 1"); | |
f8c3bb9c | 40 | 1; |
de84ff2b RS |
41 | END |
42 | } | |
43 | ||
44 | if ($] >= 5.018) { | |
45 | is (eval <<'END', 1, 'lexical subs compiles') or diag $@; | |
46 | use experimental 'lexical_subs'; | |
47 | my sub foo { 1 }; | |
48 | is(foo(), 1, "foo is 1"); | |
49 | 1; | |
50 | END | |
51 | } | |
52 | ||
9c71c2c5 | 53 | if ($] >= 5.021005) { |
e87ace2e | 54 | is (eval <<'END', 1, 'ref aliasing compiles') or diag $@; |
baabe3fb | 55 | use experimental 'refaliasing'; |
9c71c2c5 CBW |
56 | \@a = \@b; |
57 | is(\@a, \@b, '@a and @b are the same after \@a=\@b'); | |
58 | 1; | |
59 | END | |
60 | } | |
61 | ||
de84ff2b RS |
62 | done_testing; |
63 |