Commit | Line | Data |
---|---|---|
72ed4618 FC |
1 | BEGIN { |
2 | chdir 't'; | |
3 | require './test.pl'; | |
4 | set_up_inc("../lib"); | |
5 | } | |
6 | ||
7 | plan 13; | |
8 | ||
9 | $::TODO = ' '; | |
10 | ||
11 | eval '\$x = \$y'; | |
12 | like $@, qr/^Experimental lvalue references not enabled/, | |
13 | 'error when feature is disabled'; | |
14 | ||
15 | use feature 'lvalue_refs'; | |
16 | ||
17 | { | |
18 | my($w,$c); | |
19 | local $SIG{__WARN__} = sub { $c++; $w = shift }; | |
20 | eval '\$x = \$y'; | |
21 | is $c, 1, 'one warning from lv ref assignment'; | |
22 | like $w, qr/^Lvalue references are experimental/, | |
23 | 'experimental warning'; | |
24 | } | |
25 | ||
26 | no warnings 'experimental::lvalue_refs'; | |
27 | ||
28 | # Scalars | |
29 | ||
30 | eval '\$x = \$y'; | |
31 | is \$x, \$y, '\$pkg_scalar = ...'; | |
32 | my $m; | |
33 | eval '\$m = \$y'; | |
34 | is \$m, \$y, '\$lexical = ...'; | |
35 | eval '\my $n = \$y'; | |
36 | is \$n, \$y, '\my $lexical = ...'; | |
37 | @_ = \$_; | |
38 | eval '\($x) = @_'; | |
39 | is \$x, \$_, '\($pkgvar) = ... gives list context'; | |
40 | my $o; | |
41 | eval '\($o) = @_'; | |
42 | is \$o, \$_, '\($lexical) = ... gives list cx'; | |
43 | eval '\(my $p) = @_'; | |
44 | is \$p, \$_, '\(my $lexical) = ... gives list cx'; | |
45 | eval '\($_a, my $a) = @{[\$b, \$c]}'; | |
46 | is \$_a, \$b, 'package scalar in \(...)'; | |
47 | is \$a, \$c, 'lex scalar in \(...)'; | |
48 | eval '(\$_b, \my $b) = @{[\$b, \$c]}'; | |
49 | is \$_b, \$::b, 'package scalar in (\$foo, \$bar)'; | |
50 | is \$b, \$c, 'lex scalar in (\$foo, \$bar)'; | |
51 | ||
52 | # Array Elements | |
53 | ||
54 | # ... | |
55 | ||
56 | # Hash Elements | |
57 | ||
58 | # ... | |
59 | ||
60 | # Arrays | |
61 | ||
62 | # ... | |
63 | ||
64 | # Hashes | |
65 | ||
66 | # ... | |
67 | ||
68 | # Subroutines | |
69 | ||
70 | # ... | |
71 | ||
72 | # Mixed List Assignments | |
73 | ||
74 | # ... | |
75 | ||
76 | # Errors | |
77 | ||
78 | # ... |