Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
S02-names/{caller,our}.t: update and fudge for niecza
  • Loading branch information
sorear committed Aug 2, 2011
1 parent 19e9310 commit 10846df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
6 changes: 4 additions & 2 deletions S02-names/caller.t
Expand Up @@ -9,7 +9,7 @@ plan 18;
my $sub = sub { $CALLER::a };

{
my $a = 3;
my $a is dynamic = 3;
is $sub(), 3, 'basic $CALLER:: works';
}
}
Expand Down Expand Up @@ -84,6 +84,7 @@ plan 18;
}

my $abs = 23;
#?niecza skip 'strictness'
dies_ok { bar() },
'vars not declared "is dynamic" are not accessible via $CALLER::';
}
Expand Down Expand Up @@ -115,9 +116,10 @@ plan 18;
is $_, 43, '$_ is implicitly rw (2)';
}

#?niecza 2 skip 'pending confirmation'
{
my sub modify { $CALLER::foo++ }
my $foo is dynamic = 42;
my $*foo is dynamic = 42;
#?pugs 2 todo 'bug'
lives_ok { modify() },
'"is dynamic" vars declared "is rw" are rw when accessed with $CALLER:: (1)';
Expand Down
21 changes: 10 additions & 11 deletions S02-names/our.t
Expand Up @@ -6,22 +6,21 @@ plan 10;
# L<S02/Names/Symbols in the current package>

{
eval 'sub eval_born { 5 }';
ok $! !~~ Exception, 'can define a sub in eval';
dies_ok { eval_born() }, 'call to eval-born sub as multi dies';
eval_lives_ok 'our sub eval_born { 5 }', 'can define a sub in eval';
eval_dies_ok 'eval_born()', 'call to eval-born sub outside eval dies';
#?rakudo skip 'Null PMC access in invoke()'
is OUR::eval_born(), 5, 'call to eval-born sub works';
is OUR::eval_born(), 5, 'call to eval-born our sub via OUR works';
}

# RT #63882
{
enum A <a b c>;
my enum A <a b c>;
#?rakudo todo 'nom regression'
is c, 2, 'c is 2 from enum';
eval 'sub c { "sub c" }';
ok $! !~~ Exception, 'can define sub c in eval after c defined in enum';
is +c, 2, 'c is 2 from enum';
eval_lives_ok 'our sub c { "sub c" }',
'can define my sub c in eval after c defined in enum';
#?rakudo todo 'nom regression'
is c, 2, 'c is still 2 from enum';
is +c, 2, 'c is still 2 from enum';
#?rakudo skip 'OUR::subname() does not work'
is OUR::c(), 'sub c', 'sub c called with OUR:: works';
}
Expand All @@ -30,10 +29,10 @@ plan 10;
{
our $rt69460 = 1;
#?rakudo todo 'RT 69460'
eval_lives_ok 'class RT69460 { $rt69460++ }',
eval_lives_ok 'class RT69460 { $GLOBAL::rt69460++ }',
'can compile a class that modifies our variable';
#?rakudo skip 'RT 69460'
ok T.new ~~ RT69460, 'can instantiate class that modifies our variable';
ok ::OUR::RT69460.new ~~ ::OUR::RT69460, 'can instantiate class that modifies our variable';
#?rakudo todo 'RT 69460'
is $rt69460, 2, 'class can modify our variable';
}
Expand Down

0 comments on commit 10846df

Please sign in to comment.