diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-09-20 11:46:14 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 21:53:49 -0700 |
commit | 72ed461802ec8aae014d49fcdef5aba93e93d1eb (patch) | |
tree | 60abb0b14014564d9320402b30fd58a3efce2ca1 /t/op | |
parent | be16e595fd8043a26fd91f476ab13f121e70b39c (diff) | |
download | perl-72ed461802ec8aae014d49fcdef5aba93e93d1eb.tar.gz |
To-do tests for scalar lvalue refs
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/lvref.t | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/t/op/lvref.t b/t/op/lvref.t new file mode 100644 index 0000000000..5749ddf2a3 --- /dev/null +++ b/t/op/lvref.t @@ -0,0 +1,78 @@ +BEGIN { + chdir 't'; + require './test.pl'; + set_up_inc("../lib"); +} + +plan 13; + +$::TODO = ' '; + +eval '\$x = \$y'; +like $@, qr/^Experimental lvalue references not enabled/, + 'error when feature is disabled'; + +use feature 'lvalue_refs'; + +{ + my($w,$c); + local $SIG{__WARN__} = sub { $c++; $w = shift }; + eval '\$x = \$y'; + is $c, 1, 'one warning from lv ref assignment'; + like $w, qr/^Lvalue references are experimental/, + 'experimental warning'; +} + +no warnings 'experimental::lvalue_refs'; + +# Scalars + +eval '\$x = \$y'; +is \$x, \$y, '\$pkg_scalar = ...'; +my $m; +eval '\$m = \$y'; +is \$m, \$y, '\$lexical = ...'; +eval '\my $n = \$y'; +is \$n, \$y, '\my $lexical = ...'; +@_ = \$_; +eval '\($x) = @_'; +is \$x, \$_, '\($pkgvar) = ... gives list context'; +my $o; +eval '\($o) = @_'; +is \$o, \$_, '\($lexical) = ... gives list cx'; +eval '\(my $p) = @_'; +is \$p, \$_, '\(my $lexical) = ... gives list cx'; +eval '\($_a, my $a) = @{[\$b, \$c]}'; +is \$_a, \$b, 'package scalar in \(...)'; +is \$a, \$c, 'lex scalar in \(...)'; +eval '(\$_b, \my $b) = @{[\$b, \$c]}'; +is \$_b, \$::b, 'package scalar in (\$foo, \$bar)'; +is \$b, \$c, 'lex scalar in (\$foo, \$bar)'; + +# Array Elements + +# ... + +# Hash Elements + +# ... + +# Arrays + +# ... + +# Hashes + +# ... + +# Subroutines + +# ... + +# Mixed List Assignments + +# ... + +# Errors + +# ... |