Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t/spec] begin cleansing of eval and todos that should skip

git-svn-id: http://svn.pugscode.org/pugs@27987 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit ea4d235761b67df728b0018f2e7d0ddd981822c8 1 parent 83d098b
kyle authored
12 S02-builtin_data_types/enum.t
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 40;
+plan 35;
# L<S12/Enums>
{
my %hash; eval '%hash = enum «:Mon(1) Tue Wed Thu Fri Sat Sun»';
@@ -111,32 +111,22 @@ is %hash.values, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'), '
# RT #63826
{
class EnumClass { enum C <a b c> }
- #?rakudo todo 'RT #63826'
- lives_ok { EnumClass::C::a }, 'can refer to enum element in class';
#?rakudo skip 'RT #63826'
is EnumClass::C::a, 0, 'enum element in class has the right value';
module EnumModule { enum M <a b c> }
- #?rakudo todo 'RT #63826'
- lives_ok { EnumModule::M::a }, 'can refer to enum element in module';
#?rakudo skip 'RT #63826'
is EnumModule::M::b, 1, 'enum element in module has the right value';
package EnumPackage { enum P <a b c> }
- #?rakudo todo 'RT #63826'
- lives_ok { EnumPackage::P::a }, 'can refer to enum element in package';
#?rakudo skip 'RT #63826'
is EnumPackage::P::c, 2, 'enum element in package has the right value';
role EnumRole { enum R <a b c> }
- #?rakudo todo 'RT #63826'
- lives_ok { EnumRole::R::a }, 'can refer to enum element in role';
#?rakudo skip 'RT #63826'
is EnumRole::R::a, 0, 'enum element in role has the right value';
grammar EnumGrammar { enum G <a b c> }
- #?rakudo todo 'RT #63826'
- lives_ok { EnumGrammar::G::a }, 'can refer to enum element in grammar';
#?rakudo skip 'RT #63826'
is EnumGrammar::G::b, 1, 'enum element in grammar has the right value';
}
6 S03-operators/inplace.t
View
@@ -4,7 +4,7 @@ use Test;
# L<S03/Assignment operators/A op= B>
-plan 24;
+plan 22;
#?rakudo skip '.= with spaces'
{
@@ -68,10 +68,10 @@ is ~@b, "a b d e z", "inplace sort";
my @b = @a.sort: {1};
is @b, @a_orig, 'worked: @a.sort: {1}';
- lives_ok { @a.=sort: {1} }, 'lives: @a.=sort: {1}';
+ @a.=sort: {1};
is @a, @a_orig, 'worked: @a.=sort: {1}';
- lives_ok { @a.=sort }, 'lives: @a.=sort';
+ @a.=sort;
is @a, (1,2,3), 'worked: @a.=sort';
}
4 S03-operators/misc.t
View
@@ -7,7 +7,7 @@ use Test;
Tests for Synopsis 3
=end kwid
-plan 62;
+plan 61;
my $str1 = "foo";
my $str2 = "bar";
@@ -162,8 +162,6 @@ ok(?(42 > 12 & 20 & 32), "test the all infix operator");
# RT #63778
{
my @a = 1, 2, 3;
- #?rakudo todo 'RT #63778'
- lives_ok { @a min 4 }, 'lives: @array min 4';
#?rakudo skip 'RT #63778'
is @a min 4, 1, 'works: @array min 4';
}
4 S03-operators/smartmatch.t
View
@@ -410,7 +410,7 @@ ok NaN ~~ NaN, 'NaN ~~ NaN is True';
# need to test in eval() since class defintions happen at compile time,
# ie before the plan is set up.
-eval_lives_ok 'class A { method foo { diag "" ~~ * } }; A.new.foo',
- 'smartmatch in a class lives (RT #62196)';
+eval_lives_ok 'class A { method foo { return "" ~~ * } }; A.new.foo',
+ 'smartmatch in a class lives (RT 62196)';
# vim: ft=perl6
2  S03-operators/ternary.t
View
@@ -67,6 +67,6 @@ is((4 or 5 ?? 6 !! 7), 4, "operator priority");
is($foo, "yay", "defining a postfix<!> doesn't screw up ternary op");
}
-eval_dies_ok q[ 1 ?? 2,3 !! 4,5 ], 'Ternary error (RT #66840)';
+eval_dies_ok q[ 1 ?? 2,3 !! 4,5 ], 'Ternary error (RT 66840)';
# vim: ft=perl6
6 S04-declarations/state.t
View
@@ -273,9 +273,9 @@ plan 37;
# Test for RT #67058
sub bughunt1 { (state $svar) }
{
- sub bughunt2 { state $x //= 17; $x++ }
- lives_ok { bughunt2() },
- 'a state variable in parens lives with a state variable with //= init';
+ sub bughunt2 { state $x //= 17; ++$x }
+ is bughunt2(), 18,
+ 'a state variable in parens works with a state variable with //= init';
}
# vim: ft=perl6
2  S04-statement-modifiers/for.t
View
@@ -86,6 +86,8 @@ plan 14;
eval 'say for 1';
ok $! ~~ Exception, '"say for 1" (two spaces) is an error';
+ # XXX The problem with this test is the error messages might differ
+ # for innocuous reasons (e.g., a line number)
#?rakudo 2 todo 'RT #61494'
is "$!", $errmsg, 'error for two spaces is the same as one space';
ok "$!" ~~ /\b say \b/, 'error message is for "say"';
8 S04-statements/try.t
View
@@ -4,7 +4,7 @@ use Test;
# L<S04/"Statement parsing"/"or try {...}">
-plan 29;
+plan 28;
{
# simple try
@@ -197,9 +197,9 @@ plan 29;
CATCH { return 73313 if ! $catches++; }
}
}
- lives_ok { rt63430() }, 'can call rt63430()';
- #?rakudo todo 'Null PMC access'
- lives_ok { rt63430().perl }, 'can call rt63430() and examine the result';
+
+ #?rakudo skip 'Null PMC access'
+ is rt63430().perl, 63430.perl, 'can call rt63430() and examine the result';
#?rakudo skip 'Null PMC access in type()'
is rt63430(), 63430, 'CATCH does not intercept return from try block';
#?rakudo todo 'RT #63430'
4 S05-interpolation/regex-in-variable.t
View
@@ -8,7 +8,7 @@ version 0.3 (12 Apr 2004), file t/patvar.t.
=end pod
-plan 15;
+plan 14;
# L<S05/Variable (non-)interpolation>
@@ -30,8 +30,6 @@ ok("aaaaab" ~~ m/<{$var}>/, 'Rulish scalar match');
# RT #61960
{
my $a = 'a';
- #?rakudo todo 'Null PMC access in get_string()'
- lives_ok { 'a' ~~ / $a / }, 'can match with a string as a rx';
#?rakudo skip 'Null PMC access in get_string()'
ok 'a' ~~ / $a /, 'match with string as rx works';
}
2  S05-metasyntax/charset.t
View
@@ -58,7 +58,7 @@ ok( "foo" ~~ /<[f] #`[comment] + [o]>/, 'comment embedded in charset works' );
# RT #67122
#?rakudo skip 'large \\x char spec in regex (RT #67122) (noauto)'
-eval_lives_ok( '/<[\x10000..\xEFFFF]>/', 'large \\x char spec in regex' );
+ok "\x[10001]" ~~ /<[\x10000..\xEFFFF]>/, 'large \\x char spec';
}
13 S05-metasyntax/regex.t
View
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 27;
+plan 26;
# L<S05/Regexes are now first-class language, not strings>
@@ -70,20 +70,15 @@ lives_ok { my Regex $x = rx/foo/ }, 'Can store regexes in typed variables';
ok 'mmm, pasta' ~~ m/<food>/, 'named rule outside of a grammar works';
}
-# RT #67234
-{
- #?rakudo todo 'RT #67234'
- lives_ok { undef ~~ / x / }, 'match against undef lives';
- #?rakudo skip 'RT #67234'
- ok not undef ~~ / x /, 'match against undef does not match';
-}
+#?rakudo skip 'RT #67234'
+ok not undef ~~ / 'RT #67234' /, 'match against undef does not match';
#?rakudo todo 'RT #67612'
eval_dies_ok q['x' ~~ m/RT (#)67612 /], 'commented capture end = parse error';
# L<S05/Simplified lexical parsing of patterns/The semicolon character>
-eval_dies_ok 'rx/;/', 'bare ";" is rx is not allowed';
+eval_dies_ok 'rx/;/', 'bare ";" in rx is not allowed';
eval_dies_ok q{';' ~~ /;/}, 'bare ";" in match is not allowed';
isa_ok rx/\;/, Regex, 'escaped ";" in rx// works';
ok ';' ~~ /\;/, 'escaped ";" in m// works';
21 S06-advanced_subroutine_features/return.t
View
@@ -15,7 +15,7 @@ See also t/blocks/return.t, which overlaps in scope.
# reference for the spec for 'return', but I couldn't find
# one either.
-plan 77;
+plan 73;
# These test the returning of values from a subroutine.
# We test each data-type with 4 different styles of return.
@@ -301,24 +301,15 @@ is Foo::official(), 44,
# RT #61732
{
- eval_lives_ok 'sub rt61732_a { 1;; }', 'parse sub { 1;; }';
- eval_lives_ok 'sub rt61732_b { 1; CATCH {} }', 'parse sub { 1; CATCH {} }';
-}
-#?rakudo todo 'RT #61732'
-{
- my $x;
-
sub rt61732_c { 1; CATCH {} }
- lives_ok { $x = rt61732_c() }, 'can call sub ending with empty CATCH';
- is $x, 1, 'sub with empty catch block returns last value before block';
+ #?rakudo skip 'RT #61732'
+ is rt61732_c(), 1, 'sub with empty catch block returns value before block';
}
-#?rakudo todo 'RT #61732'
-{
- my $x;
+{
sub rt61732_d { 1;; }
- lives_ok { $x = rt61732_d() }, 'can call sub ending with double ;';
- is $x, 1, 'get right value from sub with double ;';
+ #?rakudo skip 'RT #61732'
+ is rt61732_d(), 1, 'get right value from sub with double ;';
}
# RT #63912
5 S12-construction/BUILD.t
View
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 8;
+plan 7;
# L<S12/Construction and Initialization/The default BUILD and BUILDALL>
@@ -78,8 +78,7 @@ is $obj.gather, 'Parent(a): (7) | Child(a, b): (7, 5)',
class RT63900_C is RT63900_P {
}
- my $c;
- lives_ok { $c = RT63900_C.new() }, 'can create child class';
+ my $c = RT63900_C.new();
is $c.counter<BUILD>, 1, 'BUILD called once';
}
5 S12-construction/construction.t
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 15;
+plan 14;
# L<S12/"Construction and Initialization">
@@ -70,9 +70,8 @@ is Foo.new("a string").a, 'a string', "our own 'new' was called";
{
class RT64116 { has %.env is rw };
- my $a;
+ my $a = RT64116.CREATE;
- lives_ok { $a = RT64116.CREATE }, 'can .CREATE class';
lives_ok { $a.env = { foo => "bar" } }, 'assign to attr of .CREATEd class';
is $a.env<foo>, 'bar', 'assignment works';
}
16 S12-methods/multi.t
View
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 20;
+plan 16;
# L<S12/"Multisubs and Multimethods">
# L<S12/"Multi dispatch">
@@ -75,10 +75,8 @@ is Bar.new.a("not an Int"), 'Any-method in Foo';
# RT #67024
#?rakudo todo 'redefintion of non-multi method (RT #67024)'
{
- my $bad_code = 'class A { method a(){0}; method a($x){1} }';
-
- eval_dies_ok $bad_code, 'redefintion of non-multi method (RT 67024)';
- eval $bad_code;
+ eval 'class A { method a(){0}; method a($x){1} }';
+ ok $! ~~ Exception, 'redefintion of non-multi method (RT 67024)';
ok "$!" ~~ /multi/, 'error message mentions multi-ness';
}
@@ -91,9 +89,7 @@ is Bar.new.a("not an Int"), 'Any-method in Foo';
multi method b() { @.order.push( 'class' ); nextsame }
}
- my $c;
- lives_ok { $c = C3.new }, 'can create class C3';
- isa_ok $c, C3;
+ my $c = C3.new;
lives_ok { $c.b }, 'can call multi-method from class with role';
is $c.order, <class role>, 'call order is correct for class and role'
@@ -110,9 +106,7 @@ is Bar.new.a("not an Int"), 'Any-method in Foo';
class C4 is P4 does R4 {
multi method b() { @.order.push( 'class' ); nextsame }
}
- my $c;
- lives_ok { $c = C4.new }, 'can create class C4';
- isa_ok $c, C4;
+ my $c = C4.new;
lives_ok { $c.b }, 'call multi-method from class with parent and role';
is $c.order, <class role parent>,
3  S12-methods/what.t
View
@@ -12,7 +12,7 @@ This test tests the C<WHAT> builtin.
# L<S12/Introspection/"WHAT">
-plan 16;
+plan 15;
# Basic subroutine/method form tests for C<WHAT>.
{
@@ -64,7 +64,6 @@ plan 16;
# RT #66928
{
- lives_ok { &infix:<+>.WHAT }, 'Can .WHAT built-in infix op';
ok &infix:<+>.WHAT ~~ Multi, '.WHAT of built-in infix op is Multi';
}
9 S29-context/eval.t
View
@@ -1,6 +1,6 @@
use v6;
use Test;
-plan 17;
+plan 16;
# L<S29/Context/"=item eval">
@@ -66,11 +66,10 @@ dies_ok({eval {42}}, 'block eval is gone');
is eval("'møp'".encode('UTF-8')), 'møp', 'eval(Buf)';
{
- #?rakudo todo 'eval coerce to string'
- lives_ok { eval 1 }, 'eval of non-string lives';
+ #?rakudo skip 'eval coerce to string'
+ is eval 88, 88, 'eval of non-string works';
+
my $number = 2;
- #?rakudo todo 'eval coerce to string'
- lives_ok { eval $number }, 'eval of non-string variable lives';
#?rakudo skip 'eval coerce to string'
is eval $number, $number, 'eval of non-string variable works';
}
4 S29-conversions/ord_and_chr.t
View
@@ -121,7 +121,7 @@ my @maps = (
"\o03", 3,
);
-plan 38+@maps*2;
+plan 37+@maps*2;
for @maps -> $char, $code {
my $descr = "\\{$code}{$code >= 32 ?? " == '{$char}'" !! ""}";
@@ -149,8 +149,6 @@ is 65.chr, 'A', "there's a .chr method";
is ord('hello'), [104, 101, 108, 108, 111], 'ord works with longer strings';
is chr(104, 101, 108, 108, 111), 'hello', 'chr works with a list of ints';
-#?rakudo todo 'RT #62772'
-lives_ok { ord("") }, 'ord("") lives';
#?rakudo skip 'RT #62772'
ok ord("") ~~ Failure, 'ord("") returns a Failure';
4 S32-array/delete.t
View
@@ -100,8 +100,8 @@ Basic C<delete> tests, see S32.
# RT #67446
{
my @array = 0..1;
- lives_ok { @array.perl }, '@array.perl lives after init';
- lives_ok { map { 1 }, @array }, 'map @array lives 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.delete(0);
#?rakudo 2 todo 'RT #67446'
lives_ok { @array.perl }, '@array.perl lives after delete';
Please sign in to comment.
Something went wrong with that request. Please try again.