Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reflect current rakudo/nom state
  • Loading branch information
coke committed Jul 9, 2011
1 parent b075ede commit db85667
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 13 deletions.
7 changes: 7 additions & 0 deletions S03-metaops/zip.t
Expand Up @@ -28,6 +28,8 @@ is (1 Z* 3), (3), 'zip-product works with scalar both sides';

# L<S03/"Hyper operators"/is assumed to be infinitely extensible>

#?rakudo todo 'nom regression'
{
is (<a b c d> Z 'x', 'z', *), <a x b z c z d z>, 'non-meta zip extends right argument ending with *';
is (1, 2, 3, * Z 10, 20, 30, 40, 50),
(1, 10, 2, 20, 3, 30, 3, 40, 3, 50), 'non-meta zip extends left argument ending with *';
Expand All @@ -36,9 +38,14 @@ is (2, 10, * Z 3, 4, 5, *).munch(10),
'non-meta zip extends two arguments ending with *';

is (<a b c d> Z~ 'x', 'z', *), <ax bz cz dz>, 'zip-concat extends right argument ending with *';
}

#?rakudo 2 skip 'nom regression'
{
is (1, 2, 3, * Z+ 10, 20, 30, 40, 50), (11, 22, 33, 43, 53), 'zip-plus extends left argument ending with *';
is (2, 10, * Z* 3, 4, 5, *).munch(5),
(6, 40, 50, 50, 50), 'zip-product extends two arguments ending with *';
}

done;

Expand Down
2 changes: 2 additions & 0 deletions S03-operators/binding-ro.t
Expand Up @@ -10,7 +10,9 @@ plan 9;
my $y = 3;
$x ::= $y;
is $x, 3, '::= on scalars took the value from the RHS';
#?rakudo todo 'nom regression'
dies_ok { $x = 5 }; '... and made the LHS RO';
#?rakudo todo 'nom regression'
is $x, 3, 'variable is still 3';
}

Expand Down
3 changes: 2 additions & 1 deletion S03-operators/binding-scalars.t
Expand Up @@ -21,7 +21,6 @@ plan 29;
my $y := $x;
is($y, 'Just Another', 'y is now bound to x');

#?rakudo todo 'binding, =:='
ok($y =:= $x, 'y is bound to x (we checked with the =:= identity op)');

my $z = $x;
Expand Down Expand Up @@ -99,11 +98,13 @@ plan 29;
is $a, 42, "bound readonly sub param was bound correctly (1)";
$val++;
#?niecza skip "difference of interpretation on ro binding"
#?rakudo todo 'nom regression'
is $a, 43, "bound readonly sub param was bound correctly (2)";

dies_ok { $a = 23 },
"bound readonly sub param remains readonly (1)";
#?niecza skip "difference of interpretation on ro binding"
#?rakudo todo 'nom regression'
is $a, 43,
"bound readonly sub param remains readonly (2)";
is $val, 43,
Expand Down
6 changes: 4 additions & 2 deletions S03-operators/eqv.t
Expand Up @@ -45,7 +45,6 @@ plan 53;
ok \@a eqv \@b, '\@array of two bound arrays are eqv';
}

#?rakudo skip 'backslashes'
{
my $a = \3;
my $b = \3;
Expand All @@ -57,7 +56,7 @@ plan 53;
ok (\$a !eqv \$b), "eqv on scalar references (1-4)";
}

#?
#?rakudo skip 'nom regression'
{
my $a = { 3 };
my $b = { 3 };
Expand All @@ -69,6 +68,7 @@ plan 53;
ok !($a eqv { 5 }), 'eqv on sub references (1-4)';
}

#?rakudo skip 'nom regression'
{
ok (&say eqv &say), "eqv on sub references (2-1)";
ok (&map eqv &map), "eqv on sub references (2-2)";
Expand All @@ -93,6 +93,7 @@ plan 53;
{
ok !({a => 1} eqv {a => 2}), "eqv on anonymous hash references (-)";
ok ({a => 1} eqv {a => 1}), "eqv on anonymous hash references (+)";
#?rakudo todo 'nom regression'
ok ({a => 2, b => 1} eqv { b => 1, a => 2}), 'order really does not matter';
ok !({a => 1} eqv {a => 1, b => 2}), 'hashes: different number of pairs';
}
Expand Down Expand Up @@ -131,6 +132,7 @@ plan 53;
is(0 eqv 1, Bool::False, 'eqv returns Bool::False when false');
}

#?rakudo skip 'nom regression'
{
is Mu eqv Mu, Bool::True, 'Mu eqv Mu';
is Any eqv Any, Bool::True, 'Any eqv Any';
Expand Down
2 changes: 1 addition & 1 deletion S03-operators/increment.t
Expand Up @@ -13,10 +13,10 @@ Verify that autoincrement/autodecrement work properly.
=end description

#?rakudo skip 'unimpl Mu++'
my $a = Mu;
is($a++, 0, 'Mu++ == 0');

#?rakudo todo 'nom regression'
$a = Mu;
nok(defined($a--), 'Mu-- is undefined');

Expand Down
9 changes: 9 additions & 0 deletions S03-operators/numeric-context.t
Expand Up @@ -21,26 +21,35 @@ isa_ok(+'1.9e3', Num, "+'1.9e3' is a Num");
is(+'Inf', Inf, "+'Inf' is Inf");
is(+'Info', 0, "+'Info' is 0");
is(+'-Inf', -Inf, "+'-Inf' is -Inf");
#?rakudo todo 'nom regression'
is(+'-Info', 0, "+'-Info' is 0");
is(+'NaN', NaN, "+'NaN' is NaN");
is(+'NaNa', 0, "+'NaNa' is 0");

{
# XXX Not sure whether the following tests are correct
#?rakudo todo 'nom regression'
is(+'Inf ', Inf, "numification of strings with whitspace (1)");
is(+'Inf o', 0, "numification of strings with whitspace (2)");
#?rakudo todo 'nom regression'
is(+'NaN ', NaN, "numification of strings with whitspace (3)");
is(+'NaN a', 0, "numification of strings with whitspace (4)");
#?rakudo todo 'nom regression'
is(+"Inf\t", Inf, "numification of strings with whitspace (5)");
is(+"Inf\to", 0, "numification of strings with whitspace (6)");
#?rakudo todo 'nom regression'
is(+"NaN\t", NaN, "numification of strings with whitspace (7)");
is(+"NaN\ta", 0, "numification of strings with whitspace (8)");
#?rakudo todo 'nom regression'
is(+"Inf\n", Inf, "numification of strings with whitspace (9)");
is(+"Inf\no", 0, "numification of strings with whitspace (10)");
#?rakudo todo 'nom regression'
is(+"NaN\n", NaN, "numification of strings with whitspace (11)");
is(+"NaN\na", 0, "numification of strings with whitspace (12)");
#?rakudo todo 'nom regression'
is(+"Inf\n\t ", Inf, "numification of strings with whitspace (13)");
is(+"Inf\n\t o", 0, "numification of strings with whitspace (14)");
#?rakudo todo 'nom regression'
is(+"NaN\n\t ", NaN, "numification of strings with whitspace (15)");
is(+"NaN\n\t a", 0, "numification of strings with whitspace (16)");
is(+"3 ", 3, "numification of strings with whitspace (17)");
Expand Down
5 changes: 5 additions & 0 deletions S03-operators/precedence.t
Expand Up @@ -67,8 +67,10 @@ ok(?((2 ~ 2 | 4 ~ 1) == 41), "and ~ binds tighter than |");

# junctive and

#?rakudo skip 'nom regression'
ok( ?( (1 & 2 | 3) ==3), '& binds tighter than |');
ok((!(1 & 2 | 3) < 2), "ditto");
#?rakudo skip 'nom regression'
ok(?((1 & 2 ^ 3) < 3), "and also ^");
ok(?(!(1 & 2 ^ 4) != 3), "blah blah blah");

Expand All @@ -80,11 +82,13 @@ ok(?(!(1 & 2 ^ 4) != 3), "blah blah blah");
eval_dies_ok 'my Mu $a = (1 ^ 2 | 3)', '^ and | may not associate';
};

#?rakudo skip 'nom regression'
{
my Mu $a = (abs -1 ^ -1); # read as abs(-1 ^ -1) -> (1^1)
ok(!($a == 1), 'junctive or binds more tightly then abs (1)');
}

#?rakudo skip 'nom regression'
{
my Mu $b = ((abs -1) ^ -1); # -> (1 ^ -1)
ok($b == 1, "this is true because only one is == 1");
Expand Down Expand Up @@ -212,6 +216,7 @@ ok ((1 => 2 => 3).value ~~ Pair), '=> is right-assoc (2)';
eval_dies_ok '1, 2 Z 3, 4 X 5, 6',
'list associativity only works between identical operators';

#?rakudo skip 'nom regression'
{
# Check a 3 != 3 vs 3 !=3 parsing issue that can cropped up in Rakudo.
# Needs careful following of STD to get it right. :-)
Expand Down
1 change: 1 addition & 0 deletions S03-smartmatch/any-hash-pair.t
Expand Up @@ -9,6 +9,7 @@ plan 7;
ok !(%a ~~ b => 'ugh'), '%hash ~~ Pair (Str, -)';
ok (%a ~~ a => 1.0), '%hash ~~ Pair (Num, +)';
ok (%a ~~ :b<foo>), '%hash ~~ Colonpair';
#?rakudo 2 todo 'nom regression'
ok (%a ~~ c => !*.defined), '%hash ~~ Pair (!*.defined, Mu)';
ok (%a ~~ d => !*.defined), '%hash ~~ Pair (!*.defined, Nil)';
ok !(%a ~~ a => 'foo'), '%hash ~~ Pair (key and val not paired)';
Expand Down
13 changes: 8 additions & 5 deletions S03-smartmatch/disorganized.t
Expand Up @@ -11,7 +11,6 @@ This tests the smartmatch operator, defined in L<S03/"Smart matching">
sub eval_elsewhere($code){ eval($code) }

#L<S03/Smart matching/Any undef undefined not .defined>
#?rakudo skip 'syntactic smar-matching'
{
ok("foo" ~~ .defined, "foo is ~~ .defined");
nok "foo" !~~ .defined, 'not foo !~~ .defined';
Expand Down Expand Up @@ -65,31 +64,34 @@ caught that case.
$result = all(@x) ~~ { $_ < 21 };
$parsed = 1;
};
#?rakudo 2 todo 'nom regression'
ok $parsed, 'C<all(@x) ~~ { ... }> parses';
ok ?$result, 'C<all(@x) ~~ { ... } when true for all';

$result = 0;
try {
$result = !(all(@x) ~~ { $_ < 20 });
};
#?rakudo todo 'nom regression'
ok $result,
'C<all(@x) ~~ {...} when true for one';

$result = 0;
try {
$result = !(all(@x) ~~ { $_ < 12 });
};
ok $result,
'C<all(@x) ~~ {...} when true for most';
#?rakudo todo 'nom regression'
ok $result, 'C<all(@x) ~~ {...} when true for most';

$result = 0;
try {
$result = !(all(@x) ~~ { $_ < 1 });
};
ok $result,
'C<all(@x) ~~ {...} when true for one';
#?rakudo todo 'nom regression'
ok $result, 'C<all(@x) ~~ {...} when true for one';
};

#?rakudo todo 'nom regression'
ok NaN ~~ NaN, 'NaN ~~ NaN is True';

# need to test in eval() since class definitions happen at compile time,
Expand Down Expand Up @@ -145,6 +147,7 @@ eval_lives_ok 'class A { method foo { return "" ~~ * } }; A.new.foo',
}

ok "foo" ~~ *, 'thing ~~ * is true';
#?rakudo todo 'nom regression'
ok ("foo" ~~ *) ~~ Bool, 'thing ~~ * is a boolean';

done();
Expand Down
2 changes: 2 additions & 0 deletions S04-declarations/multiple.t
Expand Up @@ -10,6 +10,7 @@ eval_lives_ok 'my $x; my $x',
'it is legal to declare my $x twice in the same scope.';

#?niecza skip 'Not working'
#?rakudo todo 'nom regression'
eval_lives_ok 'state $x; state $x',
'it is legal to declare state $x twice in the same scope.';

Expand All @@ -29,6 +30,7 @@ eval_dies_ok 'only sub foo {1; }; sub foo($x) {1; };',
'multiple declarations need multi or proto';

#?niecza skip "MMD"
#?rakudo todo 'nom regression'
eval_lives_ok 'proto foo {1; }; sub foo {1; }; sub foo($x) {1; };',
'multiple declarations need multi or proto';

Expand Down
7 changes: 3 additions & 4 deletions S04-declarations/my.t
Expand Up @@ -22,7 +22,6 @@ plan 68;
{
my $ret = 42;
lives_ok { $ret = (my $x) ~ $x }, 'my() variable is visible (1)';
#?rakudo todo 'scoping bug'
is $ret, "", 'my() variable is visible (2)';
}

Expand Down Expand Up @@ -199,7 +198,7 @@ my $z = 42;
{
eval_lives_ok 'my $a;my $x if 0;$a = $x', 'my $x if 0';

#?rakudo skip 'infinite loop? (noauto)'
#?rakudo todo 'fails'
eval_lives_ok 'my $a;do { 1/0; my $x; CATCH { $a = $x.defined } }';

{
Expand All @@ -211,7 +210,7 @@ my $z = 42;

{
my $a;
#?rakudo skip 'infinite loop? (noauto)'
#?rakudo todo 'fails'
eval_lives_ok 'do { 1/0;my Int $x;CATCH { $a = ?($x ~~ Int) } }';
#?rakudo todo 'previous test skipped'
ok $a, 'unreached declaration in effect at block start';
Expand All @@ -233,8 +232,8 @@ my $z = 42;
}

# used to be RT #76366, #76466
#?rakudo skip 'nom regression'
{
#?rakudo skip 'RT 76466'
nok access_lexical_a().defined,
'can call our-sub that accesses a lexical before the block was run';
{
Expand Down
3 changes: 3 additions & 0 deletions S04-statements/gather.t
Expand Up @@ -84,6 +84,7 @@ plan 17;
}

# take on array-ref
#?rakudo todo 'nom regression'
{
my @list = gather { take [1,2,3]; take [4,5,6];};
my @list2 = ([1,2,3],[4,5,6]);
Expand Down Expand Up @@ -136,6 +137,7 @@ plan 17;
is ~@list, "2 4 6 8 10", "gather with nested loop";
}

#?rakudo skip 'nom regression'
{
is (gather { take 1, 2, 3; take 4, 5, 6; }).elems, 2,
'take with multiple arguments produces one item each';
Expand All @@ -145,6 +147,7 @@ plan 17;
}

#?niecza skip 'series'
#?rakudo skip 'nom regression (needs %%)'
{
my sub grep-div(@a, $n) {
gather for @a {
Expand Down
2 changes: 2 additions & 0 deletions S06-traits/as.t
Expand Up @@ -12,12 +12,14 @@ Testing C<as> trait (coercion).

sub t1($x as Int) {
is($x.WHAT, Int, 'object bound .WHATs to the right thing');
#?rakudo todo 'nom regression'
is($x, 1, 'object bound was coerced to the right value');
}
t1(4/3);

sub t2(Rat $x as Int) {
is($x.WHAT, Int, 'object bound .WHATs to the right thing');
#?rakudo todo 'nom regression'
is($x, 2, 'object bound was coerced to the right value');
}
t2(7/3);
Expand Down
2 changes: 2 additions & 0 deletions S12-attributes/clone.t
Expand Up @@ -34,6 +34,7 @@ my $val2;
lives_ok {
$val2 = $d.get_attr()
}, '... getting attr from cloned value';
#?rakudo todo 'nom regression'
is($val2, 42, '... cloned object has proper attr value');

# Test to cover RT#62828, which exposed a bad interaction between while loops
Expand All @@ -46,6 +47,7 @@ is($val2, 42, '... cloned object has proper attr value');
is($a.b, 0, 'sanity before clone');
my $x = $a.clone( :b($a.b + 1) );
is($a.b, 0, 'clone did not change value in original object');
#?rakudo todo 'nom regression'
is($x.b, 1, 'however, in the clone it was changed');
last;
}
Expand Down
1 change: 1 addition & 0 deletions S12-construction/autopairs.t
Expand Up @@ -12,6 +12,7 @@ plan 4;
'class instantiation with autopair, no spaces');
eval_lives_ok('my $a; class Tb { has $.a }; my Tb $Tb .= new(:$a )',
'class instantiation with autopair, spaces');
#?rakudo 2 todo 'nom regression'
eval_lives_ok('my $a; role Tc { has $.a }; my Tc $c .= new(:$a)',
'role instantiation with autopair, no spaces');
eval_lives_ok('my $a; role Td { has $.a }; my Td $c .= new(:$a )',
Expand Down

0 comments on commit db85667

Please sign in to comment.