Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move a few dying tests to string eval, because an optimizer (erm, the…
… optimizer :-) catches them at compile time
  • Loading branch information
moritz committed Oct 2, 2011
1 parent 17393d0 commit 7db2936
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion S06-other/misc.t
Expand Up @@ -10,4 +10,4 @@ sub a () { my $a=4; }; #zero-arg sub to test the underlying problem #OK not us

eval_dies_ok 'e("wtz")', "e should not be defined to accept arguments";
eval_dies_ok 'pi("wtz")',"pi should not be defined to accept arguments either :) ";
dies_ok { a(3) }, "this should die, no arguments defined";
nok eval('a(3)'), "this should die, no arguments defined";
4 changes: 2 additions & 2 deletions S06-signature/errors.t
Expand Up @@ -19,8 +19,8 @@ eval_lives_ok 'sub quuuux ($!) { ... }', 'but $! is OK';

# RT #64344
{
sub empty_sig() { return }
dies_ok { empty_sig( 'RT #64344' ) },
sub empty_sig() { return };
nok eval('empty_sig("RT #64344")'),
'argument passed to sub with empty signature';
}

Expand Down
4 changes: 2 additions & 2 deletions S06-signature/passing-arrays.t
Expand Up @@ -31,11 +31,11 @@ plan 11;
my @b = 2, 3;
isa_ok pa(@b), Array, 'basic array type sanity';
#?niecza skip 'sigil-implied type constraint (?)'
dies_ok { pa(3) }, 'non-slurpy array does not take a single Int';
nok eval('pa(3)'), 'non-slurpy array does not take a single Int';

sub ph(%h) { 1 } #OK not used
#?niecza skip 'sigil-implied type constraint (?)'
dies_ok { ph(3) }, 'an Int is not a Hash';
nok eval('ph(3)'), 'an Int is not a Hash';
}

# this used to be a rakudobug, RT #62172
Expand Down
2 changes: 1 addition & 1 deletion S06-signature/slurpy-params.t
Expand Up @@ -18,7 +18,7 @@ sub mixed($pos1, *@slurp) { "|$pos1|" ~ @slurp.join('!') }

is mixed(1), '|1|', 'Positional and slurp params';
is mixed(1, 2, 3), '|1|2!3', 'Positional and slurp params';
dies_ok { mixed()}, 'at least one arg required';
nok eval(' mixed()'), 'at least one arg required';

#?rakudo skip 'types on slurpy params'
{
Expand Down
4 changes: 2 additions & 2 deletions S06-signature/unspecified.t
Expand Up @@ -10,9 +10,9 @@ sub simple { 'simple' }
#?rakudo skip 'siglist'
is &simple.signature, :(), 'signature is :() when none is specified';
is simple(), 'simple', 'can call sub with no signature specified';
dies_ok { simple( :golf<hotel> ) },
nok eval('simple( :golf<hotel> )'),
'sub with no signature dies when given a named argument';
dies_ok { simple( 'india' ) },
nok eval("simple( 'india' )"),
'sub with no signature dies when given positional argument';

sub positional { @_[0] }
Expand Down
2 changes: 1 addition & 1 deletion S06-traits/as.t
Expand Up @@ -21,6 +21,6 @@ sub t2(Rat $x as Int) {
is($x, 2, 'object bound was coerced to the right value');
}
t2(7/3);
dies_ok { t2('omg hedgehog!') }, 'Type checks still enforced';
nok eval("t2('omg hedgehog!')"), 'Type checks still enforced';

# vim: ft=perl6
5 changes: 1 addition & 4 deletions S12-methods/instance.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 37;
plan 36;

=begin pod
Expand Down Expand Up @@ -58,11 +58,8 @@ is($foo.noargs(), 42, "... parentheses after method");
# This test could use peer review to make sure it complies with the spec.
class Zoo {
method a () { my %s; %s.b }
method c () { my %s; b(%s) }
method b () { 1 }
}
dies_ok( { Zoo.new.a }, "can't call current object methods on lexical data structures");
dies_ok( { Zoo.new.c }, "meth(%h) is not a valid method call syntax");
}
# doesn't match, but defines "b"
sub b() { die "oops" }
Expand Down
2 changes: 1 addition & 1 deletion S12-subset/subtypes.t
Expand Up @@ -58,7 +58,7 @@ is(eval("$abs; my_abs(-5)"), 5, "and they actually work");
my subset Int::Even of Int where { $^num % 2 == 0 }
ok my Int::Even $c = 6;
ok $c ~~ Int::Even, "our var is a Int::Even";
try { $c = eval 7 }
try { $c = 7 }
is $c, 6, "setting a Int::Even to an odd value dies";
ok eval('!try { my Int::Even $d }'),
"lexically declared subtype went out of scope";
Expand Down

0 comments on commit 7db2936

Please sign in to comment.