Skip to content

Commit

Permalink
[t] move scoped_named_subs.t to spec/, remove an obsolete test
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@25437 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Feb 19, 2009
1 parent 1c55256 commit 5579397
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions S06-routine-modifiers/scoped-named-subs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use v6;
use Test;
plan 8;

# L<S06/Named subroutines>

#first lets test lexical named subs
{
my Str sub myNamedStr() { return 'string' };
is myNamedStr(), 'string', 'lexical named sub() return Str';
}
is eval('myNamedStr()'), '', 'Correct : lexical named sub myNamedStr() should NOT BE available outside its scope';

{
my Int sub myNamedInt() { return 55 };
is myNamedInt(), 55, 'lexical named sub() return Int';
}
eval_dies_ok('myNamedInt()'), 'Correct : lexical named sub myNamedInt() should NOT BE available outside its scope';


#packge-scoped named subs

{
our Str sub ourNamedStr() { return 'string' };
is ourNamedStr(), 'string', 'package-scoped named sub() return Str';
}
is ourNamedStr(), 'string', 'Correct : package-scoped named sub ourNamedStr() should BE available in the whole package';


{
our Int sub ourNamedInt() { return 55 };
is ourNamedInt(), 55, 'package-scoped named sub() return Int';
}
is ourNamedInt(), 55, 'Correct : package-scoped named sub ourNamedInt() should BE available in the whole package';

0 comments on commit 5579397

Please sign in to comment.