Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

eval => EVAL in S02, take 2

  • Loading branch information...
commit 7cac63fcab7fa13a787c1741fb277e7335947144 1 parent 0bb81f8
@FROGGS FROGGS authored
View
4 S02-names-vars/list_array_perl.t
@@ -48,7 +48,7 @@ my @tests = (
#?pugs skip 'hanging test'
#?niecza skip 'hanging test'
- is ~$foo.perl.eval, ~$foo,
+ is ~$foo.perl.EVAL, ~$foo,
".perl worked correctly on a recursive arrayref";
}
@@ -89,7 +89,7 @@ my @tests = (
my @reconstituted = @( EVAL $dehydrated );
is @reconstituted, @original,
- "eval of .perl returns original for '$dehydrated'";
+ "EVAL of .perl returns original for '$dehydrated'";
@original = (1,);
$dehydrated = @original.perl;
View
2  S02-names-vars/names.t
@@ -124,7 +124,7 @@ dies_ok {
EVAL 'class A { has $.a}; my $a = A.new();';
EVAL 'class A { has $.a}; my $a = A.new();';
EVAL 'class A { has $.a}; my $a = A.new();';
-}, 'can *not* redefine a class in eval -- classes are package scoped';
+}, 'can *not* redefine a class in EVAL -- classes are package scoped';
# RT #83874
{
View
6 S02-names-vars/perl.t
@@ -92,7 +92,7 @@ my @tests = (
#?pugs skip 'hanging test'
#?niecza skip 'hanging test'
- is ~$foo.perl.eval, ~$foo,
+ is ~$foo.perl.EVAL, ~$foo,
".perl worked correctly on a recursive hashref";
}
@@ -107,7 +107,7 @@ my @tests = (
#?pugs skip 'hanging test'
#?niecza skip 'hanging test'
- is ~$foo.perl.eval, ~$foo,
+ is ~$foo.perl.EVAL, ~$foo,
".perl worked correctly on a mixed arrayref/hashref recursive structure";
}
@@ -170,7 +170,7 @@ my @tests = (
# RT #69869
{
is 1.0.WHAT.gist, Rat.gist, '1.0 is Rat';
- is EVAL( 1.0.perl ).WHAT.gist, Rat.gist, "1.0 perl'd and eval'd is Rat";
+ is EVAL( 1.0.perl ).WHAT.gist, Rat.gist, "1.0 perl'd and EVAL'd is Rat";
}
View
2  S02-types/bag.t
@@ -208,7 +208,7 @@ sub showkv($x) {
lives_ok { $s = $b.perl }, ".perl lives";
isa_ok $s, Str, "... and produces a string";
ok $s.chars < 1000, "... of reasonable length";
- lives_ok { $c = EVAL $s }, ".perl.eval lives";
+ lives_ok { $c = EVAL $s }, ".perl.EVAL lives";
isa_ok $c, Bag, "... and produces a Bag";
is showkv($c), showkv($b), "... and it has the correct values";
}
View
2  S02-types/baghash.t
@@ -212,7 +212,7 @@ sub showkv($x) {
lives_ok { $s = $b.perl }, ".perl lives";
isa_ok $s, Str, "... and produces a string";
ok $s.chars < 1000, "... of reasonable length";
- lives_ok { $c = EVAL $s }, ".perl.eval lives";
+ lives_ok { $c = EVAL $s }, ".perl.EVAL lives";
isa_ok $c, BagHash, "... and produces a BagHash";
is showkv($c), showkv($b), "... and it has the correct values";
}
View
2  S02-types/deprecations.t
@@ -409,7 +409,7 @@ Please use the :exists adverb instead.
TEXT
} #2
-# EVAL() and .eval
+# eval() and .eval
#?niecza skip 'is DEPRECATED NYI'
#?pugs skip 'is DEPRECATED NYI'
#?rakudo.jvm skip 'tracebacks in deprecations'
View
2  S02-types/hash.t
@@ -197,7 +197,7 @@ is %dupl<a>, 3, "hash creation with duplicate keys works correctly";
#?pugs todo
{
- dies_ok { eval ' @%(a => <b>)<a>' },
+ dies_ok { EVAL ' @%(a => <b>)<a>' },
"doesn't really make sense, but shouldn't segfault, either ($!)";
}
View
2  S02-types/instants-and-durations.t
@@ -12,7 +12,7 @@ plan 12;
isa_ok $i - 1/3, Instant, 'Instant - Rat ~~ Instant';
}
-isa_ok eval('now +300'), Instant, 'now is a term, not a function';
+isa_ok EVAL('now +300'), Instant, 'now is a term, not a function';
# L<S02/Immutable types/'you may not add two instants'>
View
8 S02-types/int-uint.t
@@ -24,8 +24,8 @@ for @inttypes -> $type {
$minval = -(2**($len - 1));
}
- is(eval("my $type \$var = $maxval"), $maxval, "$type can be $maxval");
- is(eval("my $type \$var = $minval"), $minval, "$type can be $minval");
+ is(EVAL("my $type \$var = $maxval"), $maxval, "$type can be $maxval");
+ is(EVAL("my $type \$var = $minval"), $minval, "$type can be $minval");
#?pugs 5 todo
eval_dies_ok("my $type \$var = {$maxval+1}", "$type cannot be {$maxval+1}");
eval_dies_ok("my $type \$var = {$minval-1}", "$type cannot be {$minval-1}");
@@ -34,8 +34,8 @@ for @inttypes -> $type {
eval_dies_ok("my $type \$var = NaN", "$type cannot be NaN");
#?rakudo 2 skip "Cannot modify an immutable value"
- is(eval("my $type \$var = 0; \$var++; \$var"), 1, "$type \$var++ works");
- is(eval("my $type \$var = 1; \$var--; \$var"), 0, "$type \$var-- works");
+ is(EVAL("my $type \$var = 0; \$var++; \$var"), 1, "$type \$var++ works");
+ is(EVAL("my $type \$var = 1; \$var--; \$var"), 0, "$type \$var-- works");
}
# vim: ft=perl6
View
2  S02-types/lists.t
@@ -146,7 +146,7 @@ plan 28;
dies_ok { <1 2 3>.rt62836 },
'call to user-declared sub in Parcel:: class dies';
- try { eval '<1 2 3>.rt62836' };
+ try { EVAL '<1 2 3>.rt62836' };
#?pugs 2 todo
ok "$!" ~~ /rt62836/, 'error message contains name of sub';
ok "$!" ~~ /Parcel/, 'error message contains name of class';
View
2  S02-types/mix.t
@@ -209,7 +209,7 @@ sub showkv($x) {
lives_ok { $s = $m.perl }, ".perl lives";
isa_ok $s, Str, "... and produces a string";
ok $s.chars < 1000, "... of reasonable length";
- lives_ok { $c = eval $s }, ".perl.eval lives";
+ lives_ok { $c = EVAL $s }, ".perl.EVAL lives";
isa_ok $c, Mix, "... and produces a Mix";
is showkv($c), showkv($m), "... and it has the correct values";
}
View
2  S02-types/mixhash.t
@@ -217,7 +217,7 @@ sub showkv($x) {
lives_ok { $s = $m.perl }, ".perl lives";
isa_ok $s, Str, "... and produces a string";
ok $s.chars < 1000, "... of reasonable length";
- lives_ok { $c = eval $s }, ".perl.eval lives";
+ lives_ok { $c = EVAL $s }, ".perl.EVAL lives";
isa_ok $c, MixHash, "... and produces a MixHash";
is showkv($c), showkv($m), "... and it has the correct values";
}
View
18 S02-types/multi_dimensional_array.t
@@ -58,9 +58,9 @@ isa_ok($multi1[1], List);
#?rakudo 3 todo 'Null PMC access in find_method()'
#?pugs 3 todo 'multi-dimensional indexing'
-is(eval('$multi1[1;0]'), 'foo', 'got the right value at multi1 index 1,0');
-is(eval('$multi1[1;1]'), 'bar', 'got the right value at multi1 index 1,1');
-is(eval('$multi1[1;2]'), 'baz', 'got the right value at multi1 index 1,2');
+is(EVAL('$multi1[1;0]'), 'foo', 'got the right value at multi1 index 1,0');
+is(EVAL('$multi1[1;1]'), 'bar', 'got the right value at multi1 index 1,1');
+is(EVAL('$multi1[1;2]'), 'baz', 'got the right value at multi1 index 1,2');
# and the normal syntax
@@ -90,9 +90,9 @@ isa_ok($multi2[0], List);
#?rakudo 3 todo 'Null PMC access in find_method()'
#?pugs 3 todo ''
-is(eval('$multi2[0;0]'), 1, 'got the right value at multi2 index 0,0');
-is(eval('$multi2[0;1]'), 2, 'got the right value at multi2 index 0,1');
-is(eval('$multi2[0;2]'), 3, 'got the right value at multi2 index 0,2');
+is(EVAL('$multi2[0;0]'), 1, 'got the right value at multi2 index 0,0');
+is(EVAL('$multi2[0;1]'), 2, 'got the right value at multi2 index 0,1');
+is(EVAL('$multi2[0;2]'), 3, 'got the right value at multi2 index 0,2');
# normal
@@ -112,9 +112,9 @@ isa_ok($multi2[1], List);
#?rakudo 3 todo 'Null PMC access in find_method()'
#?pugs 3 todo ''
-is(eval('$multi2[1;0]'), 4, 'got the right value at multi2 index 1,0');
-is(eval('$multi2[1;1]'), 5, 'got the right value at multi2 index 1,1');
-is(eval('$multi2[1;2]'), 6, 'got the right value at multi2 index 1,2');
+is(EVAL('$multi2[1;0]'), 4, 'got the right value at multi2 index 1,0');
+is(EVAL('$multi2[1;1]'), 5, 'got the right value at multi2 index 1,1');
+is(EVAL('$multi2[1;2]'), 6, 'got the right value at multi2 index 1,2');
# normal
View
4 S02-types/nil.t
@@ -10,14 +10,14 @@ sub empty_do { do {} }
sub empty_branch_true { if 1 {} else { 1; } }
sub empty_branch_false { if 0 { 1; } else {} }
sub bare_return { return; }
-sub rt74448 { eval '' }
+sub rt74448 { EVAL '' }
ok empty_sub() === Nil, 'empty sub returns Nil';
ok empty_do() === Nil, 'do {} is Nil';
ok empty_branch_true() === Nil, 'if 1 {} is Nil';
ok empty_branch_false() === Nil, 'else {} is Nil';
ok bare_return() === Nil, 'bare return returns Nil';
-ok rt74448() === Nil, 'eval of empty string is Nil';
+ok rt74448() === Nil, 'EVAL of empty string is Nil';
nok Nil.defined, 'Nil is not defined';
ok ().defined, '() is defined';
View
24 S02-types/num.t
@@ -6,18 +6,18 @@ use Test;
plan 65;
-isa_ok( eval(1.Num.perl), Num, 'eval 1.Num.perl is Num' );
-is_approx( eval(1.Num.perl), 1, 'eval 1.Num.perl is 1' );
-isa_ok( eval(0.Num.perl), Num, 'eval 0.Num.perl is Num' );
-is_approx( eval(0.Num.perl), 0, 'eval 0.Num.perl is 0' );
-isa_ok( eval((-1).Num.perl), Num, 'eval -1.Num.perl is Num' );
-is_approx( eval((-1).Num.perl), -1, 'eval -1.Num.perl is -1' );
-isa_ok( eval(1.1.Num.perl), Num, 'eval 1.1.Num.perl is Num' );
-is_approx( eval(1.1.perl), 1.1, 'eval 1.1.Num.perl is 1.1' );
-isa_ok( eval((-1.1).Num.perl), Num, 'eval -1.1.Num.perl is Num' );
-is_approx( eval((-1.1).perl), -1.1, 'eval -1.1.Num.perl is -1.1' );
-isa_ok( eval(1e100.Num.perl), Num, 'eval 1e100.Num.perl is Num' );
-is_approx( eval(1e100.Num.perl), 1e100, 'eval 1e100.Num.perl is 1' );
+isa_ok( EVAL(1.Num.perl), Num, 'EVAL 1.Num.perl is Num' );
+is_approx( EVAL(1.Num.perl), 1, 'EVAL 1.Num.perl is 1' );
+isa_ok( EVAL(0.Num.perl), Num, 'EVAL 0.Num.perl is Num' );
+is_approx( EVAL(0.Num.perl), 0, 'EVAL 0.Num.perl is 0' );
+isa_ok( EVAL((-1).Num.perl), Num, 'EVAL -1.Num.perl is Num' );
+is_approx( EVAL((-1).Num.perl), -1, 'EVAL -1.Num.perl is -1' );
+isa_ok( EVAL(1.1.Num.perl), Num, 'EVAL 1.1.Num.perl is Num' );
+is_approx( EVAL(1.1.perl), 1.1, 'EVAL 1.1.Num.perl is 1.1' );
+isa_ok( EVAL((-1.1).Num.perl), Num, 'EVAL -1.1.Num.perl is Num' );
+is_approx( EVAL((-1.1).perl), -1.1, 'EVAL -1.1.Num.perl is -1.1' );
+isa_ok( EVAL(1e100.Num.perl), Num, 'EVAL 1e100.Num.perl is Num' );
+is_approx( EVAL(1e100.Num.perl), 1e100, 'EVAL 1e100.Num.perl is 1' );
{
my $a = 1; "$a";
View
2  S02-types/range.t
@@ -52,7 +52,7 @@ is ('a'..'a'), [< a >], 'got the right array';
$x++ for (1..4).reverse;
is $x, 4, '(1..4).reverse still turns into a list of four items';
my $y = 0;
- $y++ for @( eval((1..4).reverse.perl) );
+ $y++ for @( EVAL((1..4).reverse.perl) );
is $y, 4, '(1..4).reverse.perl returns something useful';
}
View
2  S02-types/set.t
@@ -181,7 +181,7 @@ sub showset($s) { $s.keys.sort.join(' ') }
my $c;
lives_ok { $str = $s.perl }, ".perl lives";
isa_ok $str, Str, "... and produces a string";
- lives_ok { $c = eval $str }, ".perl.eval lives";
+ lives_ok { $c = EVAL $str }, ".perl.EVAL lives";
isa_ok $c, Set, "... and produces a Set";
is showset($c), showset($s), "... and it has the correct values";
}
View
2  S02-types/sethash.t
@@ -195,7 +195,7 @@ sub showset($s) { $s.keys.sort.join(' ') }
my $c;
lives_ok { $str = $s.perl }, ".perl lives";
isa_ok $str, Str, "... and produces a string";
- lives_ok { $c = eval $str }, ".perl.eval lives";
+ lives_ok { $c = EVAL $str }, ".perl.eval lives";
isa_ok $c, SetHash, "... and produces a SetHash";
is showset($c), showset($s), "... and it has the correct values";
}
View
22 S02-types/sigils-and-types.t
@@ -24,14 +24,14 @@ ok $scalar ~~ Any, 'value contained in a $var does Mu';
ok @array.does(Positional), 'generic val in a @var is converted to Positional';
}
-ok eval('List').does(Positional), "List does Positional";
-ok eval('Array').does(Positional), "Array does Positional";
-ok eval('Range').does(Positional), "Range does Positional";
-ok eval('Parcel').does(Positional), "Parcel does Positional";
+ok EVAL('List').does(Positional), "List does Positional";
+ok EVAL('Array').does(Positional), "Array does Positional";
+ok EVAL('Range').does(Positional), "Range does Positional";
+ok EVAL('Parcel').does(Positional), "Parcel does Positional";
#?niecza skip 'Undeclared name Buf'
-ok eval('Buf').does(Positional), "Buf does Positional";
+ok EVAL('Buf').does(Positional), "Buf does Positional";
#?rakudo todo "Capture does Positional"
-ok eval('Capture').does(Positional), "Capture does Positional";
+ok EVAL('Capture').does(Positional), "Capture does Positional";
my %hash;
#?pugs todo 'feature'
@@ -40,13 +40,13 @@ ok %hash.does(Associative), 'uninitialized %var does Associative';
ok %hash.does(Associative), 'value in %var does Associative';
#?niecza todo
-ok eval('Pair').does(Associative), "Pair does Associative";
-ok eval('Set').does(Associative), "Set does Associative";
-ok eval('Bag').does(Associative), "Bag does Associative";
+ok EVAL('Pair').does(Associative), "Pair does Associative";
+ok EVAL('Set').does(Associative), "Set does Associative";
+ok EVAL('Bag').does(Associative), "Bag does Associative";
#?niecza skip 'Undeclared name QuantHash'
-ok eval('QuantHash').does(Associative), "QuantHash does Associative";
+ok EVAL('QuantHash').does(Associative), "QuantHash does Associative";
#?rakudo todo "Capture does Associative"
-ok eval('Capture').does(Associative), "Capture does Associative";
+ok EVAL('Capture').does(Associative), "Capture does Associative";
sub foo {}
View
4 S02-types/subset.t
@@ -18,13 +18,13 @@ subset Even of Int where { $_ % 2 == 0 };
};
#?pugs todo
-dies_ok { eval('my Even $x = 3') },
+dies_ok { EVAL('my Even $x = 3') },
"Can't assign value that violates type constraint via subset";
# RT # 69518'
#?niecza todo
#?pugs todo
-dies_ok { eval('Even.new') }, 'Cannot instantiate a subtype';
+dies_ok { EVAL('Even.new') }, 'Cannot instantiate a subtype';
#?pugs skip "can't find Even"
{
View
18 S02-types/unicode.t
@@ -34,15 +34,15 @@ is $u.chars, 1, '.chars defaults to .graphs';
E0]";
#?pugs 9 todo ''
-is eval('substr $u, 3.as(Bytes), 1.as(Bytes)'), "\x[41]", 'substr with Bytes as units - utf8';
-is eval('substr $u, 3.as(Codes), 1.as(Codes)'), "\x[0300]", 'substr with Codes as units - utf8';
-is eval('substr $u, 4.as(Graphs), 1.as(Graphs)'), "\x[E0]", 'substr with Graphs as units - utf8';
-is eval('substr $u, 3.as(Graphs), 1.as(Codes)'), "\x[41]", 'substr with Graphs and Codes as units 1 - utf8';
-is eval('substr $u, 4.as(Codes), 1.as(Graphs)'), "\x[41, 0302, 0323]", 'substr with Graphs and Codes as units 2 - utf8';
-is eval('substr $u, 4.as(Bytes), 1.as(Codes)'), "\x[0300]", 'substr with Bytes and Codes as units 1 - utf8';
-is eval('substr $u, 1.as(Codes), 2.as(Bytes)'), "\x[E1]", 'substr with Bytes and Codes as units 2 - utf8';
-is eval('substr $u, 3.as(Bytes), 1.as(Graphs)'), "\x[41, 0300]", 'substr with Bytes and Graphs as units 1 - utf8';
-is eval('substr $u, 3.as(Graphs), 1.as(Bytes)'), "\x[41]", 'substr with Bytes and Graphs as units 2 - utf8';
+is EVAL('substr $u, 3.as(Bytes), 1.as(Bytes)'), "\x[41]", 'substr with Bytes as units - utf8';
+is EVAL('substr $u, 3.as(Codes), 1.as(Codes)'), "\x[0300]", 'substr with Codes as units - utf8';
+is EVAL('substr $u, 4.as(Graphs), 1.as(Graphs)'), "\x[E0]", 'substr with Graphs as units - utf8';
+is EVAL('substr $u, 3.as(Graphs), 1.as(Codes)'), "\x[41]", 'substr with Graphs and Codes as units 1 - utf8';
+is EVAL('substr $u, 4.as(Codes), 1.as(Graphs)'), "\x[41, 0302, 0323]", 'substr with Graphs and Codes as units 2 - utf8';
+is EVAL('substr $u, 4.as(Bytes), 1.as(Codes)'), "\x[0300]", 'substr with Bytes and Codes as units 1 - utf8';
+is EVAL('substr $u, 1.as(Codes), 2.as(Bytes)'), "\x[E1]", 'substr with Bytes and Codes as units 2 - utf8';
+is EVAL('substr $u, 3.as(Bytes), 1.as(Graphs)'), "\x[41, 0300]", 'substr with Bytes and Graphs as units 1 - utf8';
+is EVAL('substr $u, 3.as(Graphs), 1.as(Bytes)'), "\x[41]", 'substr with Bytes and Graphs as units 2 - utf8';
#vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.