Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
6; # same as 'no strict' | ||
use Test; | ||
plan 5; | ||
|
||
# L<S02/"Names"/"When \"strict\" is in effect (which is the default except for one-liners)"> | ||
|
||
$baz = 'lax'; | ||
is $baz, 'lax', 'variable gets auto-declared when strict is turned off'; | ||
|
||
class Foo { | ||
$foo = 42; | ||
is $foo, 42, 'variable gets auto-declared in packages'; | ||
} | ||
|
||
is $Foo::foo, 42, 'lax declared variable is package scoped'; | ||
|
||
{ | ||
use strict; | ||
throws_like '$foo = 10;', X::Undeclared, suggestions => ''; | ||
} | ||
|
||
#?rakudo 1 skip 'lax mode does not propagate into EVAL yet' | ||
{ | ||
is EVAL('$bar'), Any, 'lax mode propagates into EVAL blocks' | ||
} |