This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c: Null list and pushmark in void cx
[perl5.git] / cpan / experimental / t / basic.t
CommitLineData
de84ff2b
RS
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');
f8c3bb9c 12 1;
de84ff2b
RS
13END
14}
15else {
16 fail("No experimental features available on perl $]");
17}
18
19if ($] >= 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;
32END
33}
34
35if ($] >= 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
41END
42}
43
44if ($] >= 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;
50END
51}
52
53done_testing;
54