Skip to content

Commit

Permalink
add tests for (no/use) strict
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Sep 28, 2014
1 parent db49548 commit 0004afd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions S02-names/strict.pl
@@ -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'
}

0 comments on commit 0004afd

Please sign in to comment.