Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (46 sloc) 1.311 kb
65d39ea3 » moritz
2008-09-18 [t/spec] tests for code objects in signatures
1 use v6;
2 use Test;
ff7d3bf9 » moritz
2010-04-21 [t/spec] test for RT #67932
3 plan 8;
65d39ea3 » moritz
2008-09-18 [t/spec] tests for code objects in signatures
4
3caeec06 » azawawi
2008-09-28 [t/spec] Added a smartlink and a future move order TODO ;-)
5 # TODO: move this test to closure-parameters.t if it works in the future
6
7 # L<S06/Closure parameters>
65d39ea3 » moritz
2008-09-18 [t/spec] tests for code objects in signatures
8
9 our $collector = 2;
10 sub to_be_called($x) {
11 $collector += $x;
12 }
13
14 sub tester(&my_sub) {
15 my_sub(4);
16 }
17
18 tester(&to_be_called);
19 ok $collector == 6, 'Can call my_sub() if &my_sub was a parameter';
20
21 tester(sub ($x) { $collector = 3 * $x });
22 ok $collector == 12, 'same with anonymous sub';
23
f3414807 » lwall
2010-07-15 [t/spec] more warning suppressions; remaining STD warnings are mostly…
24 sub tester2(&my_sub) { 1 } #OK not used
246ed8d5 » coke
2012-03-03 pugs fudges
25 #?pugs todo
ae9d8ff4 » moritz
2011-12-05 fudge and correct tests
26 dies_ok {eval 'tester2(42)' }, "can't pass thing that doesn't do Callable";
067f36ea » moritz
2009-01-18 [t/spec] correct a test in code.t, and add another one for RT #62432
27
28 sub not_returns_a_sub { 3 };
246ed8d5 » coke
2012-03-03 pugs fudges
29 #?pugs todo
ae9d8ff4 » moritz
2011-12-05 fudge and correct tests
30 dies_ok { eval 'tester2(not_returns_a_sub)' },
067f36ea » moritz
2009-01-18 [t/spec] correct a test in code.t, and add another one for RT #62432
31 "can't pass thing that doesn't do Callable";
02f7b853 » jnthn
2008-12-17 [t/spec] Add a test to make sure if we declare something with the & s…
32
b7487a7d » kyle
2009-10-09 [t/spec] Test for RT #68578
33 is tester2({ 'block' }), 1, 'Can pass a block to a &parameter';
34
35 # RT #68578
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
36 #?niecza todo
246ed8d5 » coke
2012-03-03 pugs fudges
37 #?pugs todo
b7487a7d » kyle
2009-10-09 [t/spec] Test for RT #68578
38 {
8dc7d4b8 » lwall
2010-07-15 [t/spec] mark various tests that intentionally declare things that ar…
39 sub rt68578( Callable &x ) {} #OK not used
28f9ab0e » kyle
2009-10-09 Fix test description (jnthn++)
40 dies_ok { rt68578({ 'block' }) },
41 "Can't pass something that isn't typed as returning Callable";
b7487a7d » kyle
2009-10-09 [t/spec] Test for RT #68578
42 }
43
ff7d3bf9 » moritz
2010-04-21 [t/spec] test for RT #67932
44 # RT #67932
45 {
46 my $tracker;
47 sub foo(&foo = &foo) {
48 $tracker = &foo
49 };
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
50 #?niecza todo
ae9d8ff4 » moritz
2011-12-05 fudge and correct tests
51 #?rakudo todo 'RT 67932'
ff7d3bf9 » moritz
2010-04-21 [t/spec] test for RT #67932
52 lives_ok { foo },
53 'can call a sub with a code object defaulting to something of its own name';
246ed8d5 » coke
2012-03-03 pugs fudges
54 #?pugs todo
ff7d3bf9 » moritz
2010-04-21 [t/spec] test for RT #67932
55 ok !$tracker.defined, 'the inner &foo is undefined (scoping)';
56 }
57
65d39ea3 » moritz
2008-09-18 [t/spec] tests for code objects in signatures
58 # vim: ft=perl6
Something went wrong with that request. Please try again.