Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 38 lines (28 sloc) 1.117 kB
5579397 [t] move scoped_named_subs.t to spec/, remove an obsolete test
moritz authored
1 use v6;
2 use Test;
3 plan 8;
4
5 # L<S06/Named subroutines>
6
7 #first lets test lexical named subs
8 {
9 my Str sub myNamedStr() { return 'string' };
10 is myNamedStr(), 'string', 'lexical named sub() return Str';
11 }
39a7b59 [t/spec] fudged scoped-named-subs.t for Rakudo
moritz authored
12 #?rakudo todo 'lexical subs'
5579397 [t] move scoped_named_subs.t to spec/, remove an obsolete test
moritz authored
13 is eval('myNamedStr()'), '', 'Correct : lexical named sub myNamedStr() should NOT BE available outside its scope';
14
15 {
16 my Int sub myNamedInt() { return 55 };
17 is myNamedInt(), 55, 'lexical named sub() return Int';
18 }
39a7b59 [t/spec] fudged scoped-named-subs.t for Rakudo
moritz authored
19 #?rakudo todo 'lexical subs'
20 eval_dies_ok('myNamedInt()', 'Correct : lexical named sub myNamedInt() should NOT BE available outside its scope');
5579397 [t] move scoped_named_subs.t to spec/, remove an obsolete test
moritz authored
21
22
23 #packge-scoped named subs
24
25 {
26 our Str sub ourNamedStr() { return 'string' };
27 is ourNamedStr(), 'string', 'package-scoped named sub() return Str';
28 }
29 is ourNamedStr(), 'string', 'Correct : package-scoped named sub ourNamedStr() should BE available in the whole package';
30
31
32 {
33 our Int sub ourNamedInt() { return 55 };
34 is ourNamedInt(), 55, 'package-scoped named sub() return Int';
35 }
36 is ourNamedInt(), 55, 'Correct : package-scoped named sub ourNamedInt() should BE available in the whole package';
37
Something went wrong with that request. Please try again.