|
1 | 1 | use v6;
|
2 | 2 |
|
3 |
| -# Test the running order of BEGIN/CHECK/INIT/END |
| 3 | +# Test the running order of BEGIN/CHECK/INIT/ENTER/END |
4 | 4 | # These blocks appear in ascending order
|
5 |
| -# [TODO] add tests for ENTER/LEAVE/KEEP/UNDO/PRE/POST/etc |
| 5 | +# [TODO] add tests for LEAVE/KEEP/UNDO/PRE/POST/etc |
6 | 6 |
|
7 | 7 | use Test;
|
8 | 8 |
|
9 |
| -plan 8; |
| 9 | +plan 7; |
10 | 10 |
|
11 | 11 | # L<S04/Phasers/END "at run time" ALAP>
|
12 | 12 |
|
13 | 13 | my $var;
|
14 |
| -my ($var_at_begin, $var_at_check, $var_at_init, $var_at_start, $var_at_enter); |
| 14 | +my ($var_at_begin, $var_at_check, $var_at_init, $var_at_enter, $var_at_leave); |
15 | 15 | my $eof_var;
|
16 | 16 |
|
17 | 17 | $var = 13;
|
@@ -39,24 +39,18 @@ ENTER {
|
39 | 39 | $var_at_enter = $var;
|
40 | 40 | }
|
41 | 41 |
|
42 |
| -START { |
43 |
| - $hist ~= 'start '; |
44 |
| - $var_at_start = $var + 1; |
45 |
| -} |
46 |
| - |
47 | 42 | END {
|
48 | 43 | # tests for END blocks:
|
49 | 44 | is $var, 13, '$var gets initialized at END time';
|
50 | 45 | is $eof_var, 29, '$eof_var gets assigned at END time';
|
51 | 46 | }
|
52 | 47 |
|
53 | 48 | #?pugs todo
|
54 |
| -is $hist, 'begin check init enter start ', 'BEGIN {} runs only once'; |
| 49 | +is $hist, 'begin check init enter ', 'BEGIN {} runs only once'; |
55 | 50 | nok $var_at_begin.defined, 'BEGIN {...} ran at compile time';
|
56 | 51 | nok $var_at_check.defined, 'CHECK {...} ran at compile time';
|
57 | 52 | nok $var_at_init.defined, 'INIT {...} ran at runtime, but ASAP';
|
58 | 53 | nok $var_at_enter.defined, 'ENTER {...} at runtime, but before the mainline body';
|
59 |
| -is $var_at_start, 14, 'START {...} at runtime, just in time'; |
60 | 54 |
|
61 | 55 | $eof_var = 29;
|
62 | 56 |
|
|
0 commit comments