Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 41 lines (31 sloc) 0.893 kb
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
1 use v6;
2
3 use Test;
4
5 plan 5;
6
4e5f604 [t/spec] fix some smartlinks
moritz authored
7 # L<S04/"Phasers"/CHECK "at compile time" ALAP>
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
8 # CHECK {...} block in "void" context
28ef8dc @coke pugs fudges
coke authored
9 #?pugs todo
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
10 {
0976c3a @jnthn Tests that want to check the action of things at BEGIN/CHECK time sho…
jnthn authored
11 my $str;
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
12 BEGIN { $str ~= "begin1 "; }
13 CHECK { $str ~= "check "; }
14 BEGIN { $str ~= "begin2 "; }
15
16 is $str, "begin1 begin2 check ", "check blocks run after begin blocks";
17 }
18
28ef8dc @coke pugs fudges
coke authored
19 #?pugs todo
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
20 {
0976c3a @jnthn Tests that want to check the action of things at BEGIN/CHECK time sho…
jnthn authored
21 my $str;
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
22 CHECK { $str ~= "check1 "; }
23 BEGIN { $str ~= "begin "; }
24 CHECK { $str ~= "check2 "; }
25
26 is $str, "begin check2 check1 ", "check blocks run in reverse order";
27 }
28
29 # CHECK {...} blocks as rvalues
30 {
0976c3a @jnthn Tests that want to check the action of things at BEGIN/CHECK time sho…
jnthn authored
31 my $str;
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
32 my $handle = { my $retval = CHECK { $str ~= 'C' } };
33
34 is $handle(), 'C', 'our CHECK {...} block returned the correct var (1)';
35 is $handle(), 'C', 'our CHECK {...} block returned the correct var (2)';
28ef8dc @coke pugs fudges
coke authored
36 #?pugs todo
7d82b18 [t] moved check.t to spec/, simplified a bit
moritz authored
37 is $str, 'C', 'our rvalue CHECK {...} block was executed exactly once';
38 }
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
39
40 # vim: ft=perl6
Something went wrong with that request. Please try again.