Survey: Let them eat sort
This commit is contained in:
parent
4b3f81e3a0
commit
a9638ae691
2 changed files with 4 additions and 2 deletions
|
|
@ -448,6 +448,7 @@ sub run {
|
||||||
|
|
||||||
# Create the Safe compartment
|
# Create the Safe compartment
|
||||||
my $compartment = Safe->new();
|
my $compartment = Safe->new();
|
||||||
|
$compartment->permit(qw(sort));
|
||||||
|
|
||||||
# Share our utility subs with the compartment
|
# Share our utility subs with the compartment
|
||||||
$compartment->share('&value');
|
$compartment->share('&value');
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Tests
|
# Tests
|
||||||
my $tests = 57;
|
my $tests = 58;
|
||||||
plan tests => $tests + 1;
|
plan tests => $tests + 1;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -80,7 +80,8 @@ SKIP: {
|
||||||
q{jump { answered(n) && !answered(X) } target}, # answered() works
|
q{jump { answered(n) && !answered(X) } target}, # answered() works
|
||||||
q{jump { value(multi) eq 'answer1, answer2' } target}, # multi-answer question stringifies in scalar context
|
q{jump { value(multi) eq 'answer1, answer2' } target}, # multi-answer question stringifies in scalar context
|
||||||
q{jump { (value(multi))[1] eq 'answer2' } target}, # multi-answer question returns list in list context
|
q{jump { (value(multi))[1] eq 'answer2' } target}, # multi-answer question returns list in list context
|
||||||
q{ sub mySub { return $_[0] + 2 } jump { mySub(1) == 3 } target } # expressions can define and use subs
|
q{ sub mySub { return $_[0] + 2 } jump { mySub(1) == 3 } target }, # expressions can define and use subs
|
||||||
|
q{ jump { (sort { $a <=> $b } ( 5, 4, 3, 2 ))[1] == 3 } target }, # sorting allowed
|
||||||
);
|
);
|
||||||
|
|
||||||
my @should_not_jump = (
|
my @should_not_jump = (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue