Permalink
Browse files

eval => EVAL in S14 to S32

  • Loading branch information...
FROGGS committed Jan 1, 2014
1 parent 06ae909 commit 5bab36fd6218ba7b4f6a29b3e909ae752422ae43
View
@@ -91,10 +91,10 @@ dies_ok { HasC.new.x = 42 }, 'typed attribute rejects things it should';
eval_dies_ok '0 but RT66178', '"but" with non-existent role dies';
{
- dies_ok { eval 'class Animal does NonExistentRole { }; 1' },
+ dies_ok { EVAL 'class Animal does NonExistentRole { }; 1' },
'a class dies when it does a non-existent role';
- try { eval 'class AnotherAnimal does NonExistentRole { }; 1' };
+ try { EVAL 'class AnotherAnimal does NonExistentRole { }; 1' };
my $err = "$!";
#?rakudo todo 'nom regression'
ok $err ~~ /NonExistentRole/,
@@ -104,15 +104,15 @@ eval_dies_ok '0 but RT66178', '"but" with non-existent role dies';
# RT #67278
{
class AClass { };
- dies_ok { eval 'class BClass does AClass { }; 1' },
+ dies_ok { EVAL 'class BClass does AClass { }; 1' },
'class SomeClass does AnotherClass dies';
- my $x = try eval 'class CClass does AClass { }; 1';
+ my $x = try EVAL 'class CClass does AClass { }; 1';
ok "$!" ~~ /AClass/, 'Error message mentions the offending non-role';
}
# RT #72840
{
- try eval 'class Boo does Boo { };';
+ try EVAL 'class Boo does Boo { };';
#?rakudo todo "can see it in the position, but even STD message doesn't include it"
ok "$!" ~~ /Boo/, 'class does itself produces sensible error message';
}
View
@@ -113,7 +113,7 @@ ok rB !~~ RT64002, 'role not matched by second role it does';
{
role RT72856A { method foo {} };
role RT72856B { method foo {} };
- try { eval 'class RT72856C does RT72856A does RT72856B {}' };
+ try { EVAL 'class RT72856C does RT72856A does RT72856B {}' };
#?pugs todo
ok $! ~~ /foo/,
'method of the same name from two different roles collide in a class composition';
@@ -50,7 +50,7 @@ is(m(@x), 2, 'multi dispatch relying on parametric subtype');
sub modify(C1 @arr) {
@arr[0] = C1.new;
}
-dies_ok({ eval 'modify(@x)' }, 'type constraints enforced properly');
+dies_ok({ EVAL 'modify(@x)' }, 'type constraints enforced properly');
# Use of parametric subtyping for assignment.
my Numeric @a;
@@ -84,7 +84,7 @@ eval_dies_ok 'role ABCD[EFGH] { }', 'role with undefined type as parameter dies'
role P[$x] { }
# ::T only makes sense in a signature here, not in
# an argument list.
- dies_ok { eval 'class MyClass does P[::T] { }' },
+ dies_ok { EVAL 'class MyClass does P[::T] { }' },
'can not use ::T in role application';
}
View
@@ -8,26 +8,26 @@ role ProvidesStub1 { method a() { 1 } };
role ProvidesStub2 { method a() { 2 } };
#?pugs todo
-dies_ok { eval 'class A does WithStub { }' },
+dies_ok { EVAL 'class A does WithStub { }' },
'need to implement stubbed methods at role-into-class composition time';
-lives_ok { eval 'role B does WithStub { }' },
+lives_ok { EVAL 'role B does WithStub { }' },
'but roles are fine';
-lives_ok { eval 'class C does WithStub { method a() { 3 } }' },
+lives_ok { EVAL 'class C does WithStub { method a() { 3 } }' },
'directly implementing the stubbed method is fine';
-lives_ok { eval 'class D does WithStub does ProvidesStub1 { }' },
+lives_ok { EVAL 'class D does WithStub does ProvidesStub1 { }' },
'composing the stubbed method is fine';
#?pugs todo
-dies_ok { eval 'class E does WithStub does ProvidesStub1 does ProvidesStub2 { }' },
+dies_ok { EVAL 'class E does WithStub does ProvidesStub1 does ProvidesStub2 { }' },
'composing stub and 2 implementations dies again';
-lives_ok { eval 'class F does WithStub does ProvidesStub1 does ProvidesStub2 {
+lives_ok { EVAL 'class F does WithStub does ProvidesStub1 does ProvidesStub2 {
method a() { 4 } }' },
'composing stub and 2 implementations allows custom implementation';
class ProvidesA { method a() { 5 } };
-lives_ok { eval 'class ChildA is ProvidesA does WithStub { }' },
+lives_ok { EVAL 'class ChildA is ProvidesA does WithStub { }' },
'stubbed method can come from parent class too';
-lives_ok { eval 'class RT115212 does WithStub { has $.a }' }, 'stubbed method can come from accessor';
+lives_ok { EVAL 'class RT115212 does WithStub { has $.a }' }, 'stubbed method can come from accessor';
class HasA { has $.a }
-lives_ok { eval 'class RT115212Child is HasA does WithStub { }' }, 'stubbed method can come from accessor in parent class';
+lives_ok { EVAL 'class RT115212Child is HasA does WithStub { }' }, 'stubbed method can come from accessor in parent class';
View
@@ -66,7 +66,7 @@ plan 13;
# RT 74092
{
- try { eval 'sub yulia is krassivaya { }' };
+ try { EVAL 'sub yulia is krassivaya { }' };
diag $!
if !ok "$!" ~~ /'unknown trait'/,
'declaration of a sub with an unknown trait mentions trait_mod:<is> in dispatch error';
View
@@ -50,24 +50,24 @@ ok @threads[0].join,'first thread joined';
ok @threads[1].join,'second thread joined';
# currently a second join on a joined thread waits forever; not good
#?pugs skip 'async tests report wrong number sometimes'
-ok eval q{#!@threads[1].join},'second thread not joinable again';
+ok EVAL q{#!@threads[1].join},'second thread not joinable again';
# L<S17/"Thread methods"/"=item detach">
#?pugs skip 'async tests report wrong number sometimes'
@threads[2] = async { ok do_something_very_important(),'again start a thread' };
#?pugs skip 'async tests report wrong number sometimes'
-ok eval q{threads[2].detach},'detach a thread';
+ok EVAL q{threads[2].detach},'detach a thread';
#?pugs skip 'async tests report wrong number sometimes'
ok !@threads[2].join,'could not join a detached thread';
# L<S17/"Thread methods"/"=item suspend">
#?pugs skip 'async tests report wrong number sometimes'
@threads[3] = async { ok do_something_very_important(),'another thread' };
#?pugs skip 'async tests report wrong number sometimes'
-ok eval q{@threads[3].suspend},' send him back to a waiting room..';
+ok EVAL q{@threads[3].suspend},' send him back to a waiting room..';
# L<S17/"Thread methods"/"=item resume">
#?pugs skip 'async tests report wrong number sometimes'
-ok eval q{@threads[3].resume},'... now he is back';
+ok EVAL q{@threads[3].resume},'... now he is back';
# vim: ft=perl6
View
@@ -59,14 +59,14 @@ is $counter, 1000, 'now we reach the end';
my @cache = ();
# STM tests on arrays
#?pugs todo 'unimpl'
-ok eval( q{
+ok EVAL( q{
contend { @cache.push( 42 ) };
} ),'method <contend> for arrays; <push> should be safe';
my %cache = ();
# STM tests on hahses
#?pugs todo 'unimpl'
-ok eval( q{
+ok EVAL( q{
contend { %cache{ 42 } == 1 };
} ),'method <contend> for hashes; insert should be safe';
View
@@ -14,7 +14,7 @@ sub d {
$y < 10 or defer;
}
#?pugs todo 'unimpl'
-ok eval( q{
+ok EVAL( q{
contend {
# ...
maybe { c() } maybe { d() };
@@ -23,7 +23,7 @@ contend {
,'contend/maybe/defer construct';
# L<S17/Atomic Code blocks/maybe>
#?pugs todo 'unimpl'
-ok eval( q{
+ok EVAL( q{
maybe { c() };
} ),'method <maybe> known';
@@ -71,7 +71,7 @@ for @tests -> $t {
$got = substr($got, 1, -1);
};
- my @got = eval $got;
+ my @got = EVAL $got;
@got = @got[ 0..@dirs-1 ];
my @expected = @dirs;
@@ -86,7 +86,7 @@ for @tests -> $t {
$got = substr($got, 1, -1);
};
- @got = eval $got;
+ @got = EVAL $got;
@got = @got[ 0..@dirs-1 ];
@expected = @dirs;
@@ -57,7 +57,7 @@ if (substr($got,0,1) ~~ "\\") {
$got = substr($got,1);
};
-my @got = eval $got;
+my @got = EVAL $got;
# fail "FIXME platform specific";
# ??? Worksforme on win32 (CORION)
is @got, @expected, "-e '' does not eat a following argument";
View
@@ -21,7 +21,7 @@ Tests for the die() builtin
my $foo = "-foo-";
try { $foo = die "bar" };
$foo; # this is testing for a bug where an error is stored into $foo in
- # the above eval; unfortunately the if below doesn't detect this on it's
+ # the above EVAL; unfortunately the if below doesn't detect this on it's
# own, so this lone $foo will die if the bug is present
ok($foo eq "-foo-");
@@ -45,7 +45,7 @@ is ({ try { if 1 { die } else { die } }; 42 }()), 42, "die in if";
my sub die_in_return () { return die };
is ({ try { die_in_return(); 23 }; 42 }()), 42, "die in return";
-#?niecza skip 'test needs rewriting, eval does not catch exceptions'
+#?niecza skip 'test needs rewriting, EVAL does not catch exceptions'
{
my $msg = 'RT 67374';
try { die $msg };
View
@@ -37,9 +37,9 @@ dies_ok {EVAL 'use Poison; 1'}, "EVAL dies on fatal use";
# L<S04/Exception handlers/Perl 6's EVAL function only evaluates strings, not blocks.>
#?pugs todo
-dies_ok({EVAL {; 42} }, 'block eval is gone');
+dies_ok({EVAL {; 42} }, 'block EVAL is gone');
-# RT #63978, eval didn't work in methods
+# RT #63978, EVAL didn't work in methods
{
class EvalTester1 {
method e($s) { EVAL $s };
@@ -65,11 +65,11 @@ dies_ok({EVAL {; 42} }, 'block eval is gone');
is EVAL("'møp'".encode('UTF-8')), 'møp', 'EVAL(Buf)';
{
- #?rakudo skip 'eval coerce to string'
- is EVAL(88), 88, 'eval of non-string works';
+ #?rakudo skip 'EVAL coerce to string'
+ is EVAL(88), 88, 'EVAL of non-string works';
my $number = 2;
- #?rakudo skip 'eval coerce to string'
+ #?rakudo skip 'EVAL coerce to string'
is EVAL($number), $number, 'EVAL of non-string variable works';
}
View
@@ -68,8 +68,8 @@ my $b;
#?niecza todo "NYI"
{
diag "checking infinite waiting times";
- isa_ok eval('$b={sleep(Inf)}'), Block, 'sleep(Inf) compiles';
- isa_ok eval('$b={sleep(*)}'), Block, 'sleep(*) compiles';
+ isa_ok EVAL('$b={sleep(Inf)}'), Block, 'sleep(Inf) compiles';
+ isa_ok EVAL('$b={sleep(*)}'), Block, 'sleep(*) compiles';
} #2
# vim: ft=perl6
View
@@ -15,7 +15,7 @@ plan 9;
my sub ok_eval1($code) {
#?pugs todo 'feature'
- &Test::ok.nextwith(eval($code),$code)
+ &Test::ok.nextwith(EVAL($code),$code)
}
ok_eval1('AnyChar.isa(Str)');
View
@@ -115,7 +115,7 @@ sub make-string(@a) {
{
my @array = 0..1;
#?pugs todo
- is ~(eval @array.perl ), '0 1', '@array.perl works after init';
+ is ~(EVAL @array.perl ), '0 1', '@array.perl works after init';
is ~( map { 1 }, @array ), '1 1', 'map @array works after init';
@array[0]:delete;
lives_ok { @array.perl }, '@array.perl lives after delete';
View
@@ -10,7 +10,7 @@ plan 6;
my @a = 1,2;
is @a.perl, 'Array.new(1, 2)',
'can we serialize a simple array';
- my $ra = eval(@a.perl);
+ my $ra = EVAL(@a.perl);
is_deeply $ra, @a, 'can we roundtrip simple array';
ok $ra.of =:= Mu, 'make sure any value can be stored';
} #3
@@ -22,7 +22,7 @@ plan 6;
my Int @a = 1,2;
is @a.perl, 'Array[Int].new(1, 2)',
'can we serialize a array with constrained values';
- my $ra = eval(@a.perl);
+ my $ra = EVAL(@a.perl);
is_deeply $ra, @a, 'can we roundtrip array constrained values';
ok $ra.of =:= Int, 'make sure roundtripped values are Int';
} #3
View
@@ -82,8 +82,8 @@ plan 31;
my @shift = 1 .. 5;
eval_dies_ok('shift() ', 'shift() requires arguments');
eval_dies_ok('42.shift', '.shift should not work on scalars');
- dies_ok { eval('shift(@shift, 10)') }, 'shift() should not allow extra arguments';
- dies_ok { eval(' @shift.shift(10)') }, 'shift() should not allow extra arguments';
+ dies_ok { EVAL('shift(@shift, 10)') }, 'shift() should not allow extra arguments';
+ dies_ok { EVAL(' @shift.shift(10)') }, 'shift() should not allow extra arguments';
}
# Push with Inf arrays (waiting on answers to perl6-compiler email)
View
@@ -315,7 +315,7 @@ throws_like 'Date.new("2012/04")', X::Temporal::InvalidFormat,
invalid-str => '2012/04',
target => 'Date';
-throws_like 'eval("foo", :lang<no-such-language>)',
+throws_like 'EVAL("foo", :lang<no-such-language>)',
X::Eval::NoSuchLang,
lang => 'no-such-language';
@@ -329,7 +329,7 @@ throws_like 'use fatal; (1+2i).Real', X::Numeric::Real, target => Real;
#?rakudo skip 'RT 114134'
throws_like 'my class A {}; (-> &c, $m { A.new()(); CATCH { default { $m } } } )(A, "")', X::TypeCheck::Binding;
-dies_ok {eval(class A{}; (-> &c, $m { A.new()(); CATCH { default { $m } } } )(A, "")) }, "Should fail type check with unbound variable";
+dies_ok {EVAL(class A{}; (-> &c, $m { A.new()(); CATCH { default { $m } } } )(A, "")) }, "Should fail type check with unbound variable";
}
# RT #75640
@@ -348,7 +348,7 @@ throws_like '["a" "b"]', X::Syntax::Confused, reason => 'Two terms in a row';
# suggestions
my $emits_suggestions = False;
{
- try eval('my $foo = 10; say $Foo');
+ try EVAL('my $foo = 10; say $Foo');
$emits_suggestions = True if $!.^can("suggestions");
}
@@ -363,34 +363,34 @@ if $emits_suggestions {
throws_like 'class Baz is Juntcion {}', X::Inheritance::UnknownParent, suggestions => 'Junction';
{
- try eval('say huc("foo")');
+ try EVAL('say huc("foo")');
ok $! ~~ X::Undeclared::Symbols, "huc throws X::Undeclared::Symbols";
is $!.routine_suggestion<huc>, ["&uc"], '&uc is a suggestion';
}
- try eval('toolongtomatchanything()');
+ try EVAL('toolongtomatchanything()');
is +($!.routine_suggestion<toolongtomatchanything>), 0, "no suggestions for a strange name";
ok $!.message !~~ /Did you mean/, "doesn't show suggestions if there are none.";
- try eval('class TestClassFactoryInterfaceBridgeMock is TooLongOfANameToBeConsideredGoodPerl { }');
+ try EVAL('class TestClassFactoryInterfaceBridgeMock is TooLongOfANameToBeConsideredGoodPerl { }');
is +($!.suggestions), 0, "no suggestions for a strange class";
ok $!.message !~~ /Did you mean/, "doesn't show suggestions if there are none.";
- try eval('$i-just-made-this-up = "yup"');
+ try EVAL('$i-just-made-this-up = "yup"');
is +($!.suggestions), 0, "no suggestions for a strange variable";
ok $!.message !~~ /Did you mean/, "doesn't suggest if there's no suggestions.";
throws_like 'sub yoink(Junctoin $barf) { }', X::Parameter::InvalidType, suggestions => 'Junction';
{
- try eval('my cool $a');
+ try EVAL('my cool $a');
ok $! ~~ X::Comp::Group, 'my cool $a throws an X::Comp::Group.';
ok $!.sorrows[0] ~~ X::Undeclared, "the first sorrow is X::Undeclared.";
is $!.sorrows[0].suggestions, <Cool Bool>, "the suggestions are Cool and Bool";
}
{
- try eval('Ecxeption.new("wrong!")');
+ try EVAL('Ecxeption.new("wrong!")');
ok $! ~~ X::Undeclared::Symbols, "Ecxeption.new throws X::Undeclared::Symbols";
is $!.type_suggestion<Ecxeption>, ["Exception"], 'Exception is a suggestion';
}
View
@@ -10,7 +10,7 @@ plan 12;
my %h = a => 1, b => 2;
is %h.perl,'("a" => 1, "b" => 2).hash'|'("b" => 2, "a" => 1).hash',
'can we serialize a simple hash';
- my $rh = eval(%h.perl);
+ my $rh = EVAL(%h.perl);
is_deeply $rh, %h, 'can we roundtrip simple hash';
ok $rh.of =:= Mu, 'make sure any value can be stored';
ok $rh.keyof =:= Any, 'make sure keys are Any';
@@ -23,7 +23,7 @@ plan 12;
my Int %h = a => 1, b => 2;
is %h.perl, 'Hash[Int].new("a" => 1, "b" => 2)'|'Hash[Int].new("b" => 2, "a" => 1)',
'can we serialize a hash with constrained values';
- my $rh = eval(%h.perl);
+ my $rh = EVAL(%h.perl);
is_deeply $rh, %h, 'can we roundtrip hash constrained values';
ok $rh.of =:= Int, 'make sure roundtripped values are Int';
ok $rh.keyof =:= Any, 'make sure roundtripped keys are Any';
@@ -36,7 +36,7 @@ plan 12;
my Int %h{Str} = a => 1, b => 2;
is %h.perl, 'Hash[Int,Str].new("a" => 1, "b" => 2)'|'Hash[Int,Str].new("b" => 2, "a" => 1)',
'can we serialize a hash with constrained keys & values';
- my $rh = eval(%h.perl);
+ my $rh = EVAL(%h.perl);
is_deeply $rh, %h, 'can we roundtrip hash constrained keys & values';
ok $rh.of =:= Int, 'make sure roundtripped values are Int';
ok $rh.keyof =:= Str, 'make sure roundtripped keys are Str';
Oops, something went wrong.

0 comments on commit 5bab36f

Please sign in to comment.