Skip to content
Browse files

[t] move scoped_named_subs.t to spec/, remove an obsolete test

git-svn-id: http://svn.pugscode.org/pugs@25437 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 1c55256 commit 5579397aa84c54336ae9a479b4db08f09a3c0697 moritz committed
Showing with 35 additions and 0 deletions.
  1. +35 −0 S06-routine-modifiers/scoped-named-subs.t
View
35 S06-routine-modifiers/scoped-named-subs.t
@@ -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.
Something went wrong with that request. Please try again.