Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
niecza fudge
  • Loading branch information
coke committed Jan 1, 2012
1 parent 2e37eb9 commit ba48d7b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions S04-phasers/ascending-order.t
Expand Up @@ -50,6 +50,7 @@ END {
is $eof_var, 29, '$eof_var gets assigned at END time';
}

#?niecza todo 'niecza has "enter", also'
is $hist, 'begin check init start ', 'BEGIN {} runs only once';
nok $var_at_begin.defined, 'BEGIN {...} ran at compile time';
nok $var_at_check.defined, 'CHECK {...} ran at compile time';
Expand Down
1 change: 1 addition & 0 deletions S04-phasers/descending-order.t
Expand Up @@ -44,6 +44,7 @@ BEGIN {
$var_at_begin = $var;
}

#?niecza todo 'niecza has "enter", also'
is $hist, 'begin check init ', 'BEGIN {} runs only once';
nok $var_at_begin.defined, 'BEGIN {...} ran at compile time';
nok $var_at_check.defined, 'CHECK {...} ran at compile time';
Expand Down
2 changes: 2 additions & 0 deletions S04-phasers/init.t
Expand Up @@ -39,7 +39,9 @@ plan 11;
my $handle = { my $retval = INIT { $str ~= 'I' } };

is $str, 'I', 'our INIT {...} block already gets called';
#?niecza todo "no value"
is $handle(), 'I', 'our INIT {...} block returned the correct var (1)';
#?niecza todo "no value"
is $handle(), 'I', 'our INIT {...} block returned the correct var (2)';
is $str, 'I', 'our rvalue INIT {...} block was executed exactly once';
}
Expand Down
11 changes: 10 additions & 1 deletion S04-phasers/rvalue.t
Expand Up @@ -44,8 +44,11 @@ plan 16;
$init_val = INIT { $hist ~= 'I' };
}

#?niecza todo 'block returns no value'
is $init(), 'BCI', 'INIT {} runs only once';
#?niecza todo 'block returns no value'
is $init_val, 'BCI', 'INIT {} as rval is its ret val';
#?niecza todo 'block returns no value'
is $init(), 'BCI', 'INIT {} runs only once';

# Test CHECK {} as rval:
Expand All @@ -55,8 +58,11 @@ plan 16;
$check_val = CHECK { $hist ~= 'C' };
}

#?niecza todo 'block returns no value'
is $check(), 'BC', 'CHECK {} runs only once';
#?niecza todo 'block returns no value'
is $check_val, 'BC', 'CHECK {} as rval is its ret val';
#?niecza todo 'block returns no value'
is $check(), 'BC', 'CHECK {} runs only once';

# Test BEGIN {} as rval:
Expand All @@ -66,12 +72,15 @@ plan 16;
$begin_val = BEGIN { $hist ~= 'B' };
}

#?niecza todo 'block returns no value'
is $begin(), 'B', 'BEGIN {} runs only once';
#?niecza todo 'block returns no value'
is $begin_val, 'B', 'BEGIN {} as rval is its ret val';
#?niecza todo 'block returns no value'
is $begin(), 'B', 'BEGIN {} runs only once';

# Test END {} as rval:

#?niecza skip 'Excess arguments to eval, used 1 of 2 positionals'
ok !eval 'my $end_val = END { 3 }', "END {} can't be used as a rvalue";
}

Expand Down

0 comments on commit ba48d7b

Please sign in to comment.