Navigation Menu

Skip to content

Commit

Permalink
pugs fudge - Mu
Browse files Browse the repository at this point in the history
moritz++
  • Loading branch information
coke committed Apr 11, 2012
1 parent 395bd85 commit dc27da8
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 24 deletions.
10 changes: 5 additions & 5 deletions S02-types/array.t
Expand Up @@ -59,10 +59,10 @@ is(@array1.[0], 'foo', 'got the right value at array1 index 0 using the . notati
#?pugs emit #
my @array2 = ("test", 1, Mu);

#?pugs skip "Mu"
{
isa_ok(@array2, Array);

#?pugs 3 todo
is(+@array2, 3, 'the array2 has 3 elements');
is(@array2[0], 'test', 'got the right value at array2 index 0');
is(@array2[1], 1, 'got the right value at array2 index 1');
Expand All @@ -74,7 +74,6 @@ my @array2 = ("test", 1, Mu);
my @array3 = (@array1, @array2);
isa_ok(@array3, Array);

#?pugs todo
is(+@array3, 6, 'the array3 has 6 elements');
is(@array3[0], 'foo', 'got the right value at array3 index 0');
is(@array3[1], 'bar', 'got the right value at array3 index 1');
Expand Down Expand Up @@ -276,12 +275,13 @@ my @array2 = ("test", 1, Mu);
# defined in Any, so that .[0] is the identity operation for non-Positional
# types
#?niecza skip "Failure"
#?pugs skip "Failure"
{
is 1[0], 1, '.[0] is identiity operation for scalars (Int)';
is 'abc'[0], 'abc', '.[0] is identiity operation for scalars (Str)';
is 1[0], 1, '.[0] is identity operation for scalars (Int)';
is 'abc'[0], 'abc', '.[0] is identity operation for scalars (Str)';
nok 'abc'[1].defined, '.[1] on a scalar is not defined';
#?pugs skip "Failure"
isa_ok 1[1], Failure, 'indexing a scalar with other than 0 returns a Failure';
#?pugs todo
dies_ok { Mu.[0] }, 'but Mu has no .[]';
}

Expand Down
9 changes: 0 additions & 9 deletions S02-types/array_ref.t
Expand Up @@ -21,9 +21,7 @@ is($array_ref1.[0], 'foo', 'got the right value at array_ref1 index 0 using the

# array_ref with strings, numbers and undef

#?pugs emit #
my $array_ref2 = [ "test", 1, Mu ];
#?pugs 5 skip 'Mu'
isa_ok($array_ref2, Array);
is(+$array_ref2, 3, 'the array_ref2 has 3 elements');
is($array_ref2[0], 'test', 'got the right value at array_ref2 index 0');
Expand All @@ -36,12 +34,9 @@ ok(!$array_ref2[2].defined,'got the right value at array_ref2 index 2');
# the [] creation must be forced here, because $array_ref<n> = is
# not seen as array_ref context, because it's not

#?pugs emit # needs array_ref2
my $array_ref4 = [ $array_ref2[2, 1, 0] ];
#?pugs skip 'Mu'
isa_ok($array_ref4, Array);

#?pugs skip 'Mu'
{
is(+$array_ref4, 3, 'the array_ref4 has 3 elements');
ok(!$array_ref4[0].defined, 'got the right value at array_ref4 index 0');
Expand All @@ -51,12 +46,9 @@ isa_ok($array_ref4, Array);

# create new array_ref with 2 array_ref slices

#?pugs emit # need array_ref2, skipped above
my $array_ref5 = [ $array_ref2[2, 1, 0], $array_ref1[2, 1, 0] ];
#?pugs skip 'Mu'
isa_ok($array_ref5, Array);

#?pugs skip 'Mu'
{
is(+$array_ref5, 6, 'the array_ref5 has 6 elements');
ok(!$array_ref5[0].defined, 'got the right value at array_ref5 index 0');
Expand Down Expand Up @@ -122,7 +114,6 @@ is $array9[1][1][1][0], 42, "recursive array access (3)";
# list is in some kind of brackets, of course).
#my $array11;
#eval '$array11 = [ "a","b","c"; "d","e","f" ]';
##?pugs 3 todo
#is +$array11, 2, "AoA created using ';' contains correct number of elems";
#is +$array11[0], 3, "AoA's subarray created using ';' contains correct number of elems";
#is $array11[1][1], "e", "AoA created using ';' contains correct elem";
Expand Down
1 change: 0 additions & 1 deletion S02-types/declare.t
Expand Up @@ -218,7 +218,6 @@ plan 79;
isa_ok($vo,Whatever );
}

#?pugs skip 'Mu'
{
my Mu $mu;
ok($mu ~~ Mu );
Expand Down
1 change: 1 addition & 0 deletions S02-types/hash.t
Expand Up @@ -250,6 +250,7 @@ lives_ok { Hash.new("a" => "b") }, 'Hash.new($pair) lives';
my $x;
lives_ok { $x{'a'} }, 'can index a variable that defaults to Any';
nok $x{'a'}.defined, '... and the result is not defined';
#?pugs todo
dies_ok { Mu.{'a'} }, 'no .{ } in Mu';
}

Expand Down
3 changes: 2 additions & 1 deletion S02-types/type.t
Expand Up @@ -25,11 +25,13 @@ my Str $bar;
{
#?pugs 1 todo
dies_ok({$foo = 'xyz'}, 'Int restricts to integers');
#?pugs todo
dies_ok { $foo = Mu }, 'Int does not accept Mu';
is(($foo = 42), 42, 'Int is an integer');

#?pugs 1 todo
dies_ok({$bar = 42}, 'Str restricts to strings');
#?pugs todo
dies_ok { $bar = Mu }, 'Str does not accept Mu';
is(($bar = 'xyz'), 'xyz', 'Str is a strings');
}
Expand Down Expand Up @@ -142,7 +144,6 @@ dies_ok { my Num $n; $n = 42; }, 'Num does not accept Int';

{
# TODO: many more of these are possible
#?pugs 3 skip "Mu"
ok Any ~~ Mu, 'Any ~~ Mu';
ok Mu !~~ Any, 'Mu !~~ Any';
ok Mu !~~ Int, 'Mu !~~ Int';
Expand Down
1 change: 0 additions & 1 deletion S03-operators/repeat.t
Expand Up @@ -26,7 +26,6 @@ is(@foo[0], 'x', 'list repeat operator created correct array');
is(@foo[9], 'x', 'list repeat operator created correct array');
is(+@foo, 10, 'list repeat operator created array of the right size');

#?pugs todo
lives_ok { my @foo2 = Mu xx 2; }, 'can repeat Mu';
my @foo3 = (1, 2) xx 2;
is(@foo3[0], 1, 'can repeat lists');
Expand Down
1 change: 0 additions & 1 deletion S04-declarations/my.t
Expand Up @@ -258,7 +258,6 @@ my $z = 42; #OK not used
eval_lives_ok 'my (%h?) #OK', 'my (%h?) lives';

#RT 63588
#?pugs todo
eval_lives_ok 'my $x = 3; class A { has $.y = $x; }; A.new.y.gist',
'global scoped variables are visible inside class definitions';

Expand Down
2 changes: 1 addition & 1 deletion S04-phasers/start.t
Expand Up @@ -102,14 +102,14 @@ for <first second> {

# Test that START {} blocks are executed only once even if they return undefined
# (the first implementation ran them twice instead).
#?pugs skip 'No such subroutine: "&Mu"'
{
my $was_in_start;
my $sub = { START { $was_in_start++; Mu } };

nok $sub().defined, 'START {} returned undefined';
$sub();
$sub();
#?pugs todo
is $was_in_start, 1,
'our START { ...; Mu } block was invoked exactly once';
}
Expand Down
1 change: 1 addition & 0 deletions S09-hashes/objecthash.t
Expand Up @@ -12,6 +12,7 @@ plan 25;
is %h{$a}, 'blubb', 'Any-typed hash access (+)';
#?pugs todo
nok %h{A.new}, 'and the hash really uses ===-semantics';
#?pugs todo
dies_ok { %h{Mu.new} = 3 }, 'Any-typed hash does not like Mu keys';
#?pugs todo
ok %h.keys[0] === $a, 'returned key is correct';
Expand Down
1 change: 1 addition & 0 deletions S12-construction/destruction.t
Expand Up @@ -38,6 +38,7 @@ for 1 .. 100
$foo = Foo.new();
}

#?pugs 2 skip 'broken after Object -> Mu conversion'
ok( $in_destructor, '... only when object goes away everywhere' );
is( +@destructor_order, 2, '... only as many as available DESTROY submethods' );
is( @destructor_order[0], 'Child', 'Child DESTROY should fire first' );
Expand Down
4 changes: 1 addition & 3 deletions S32-list/join.t
Expand Up @@ -106,12 +106,10 @@ my $joined2e = join(':', @odd_list1);
#?pugs todo
is($joined2e, "1::2::3", 'join(":", @odd_list1) works');

#?pugs emit # Mu
my @odd_list2 = (1, Mu, 2, Mu, 3);

#?pugs emit # Mu
my $joined2f = join(':', @odd_list2);
#?pugs skip 'Mu'
#?pugs todo
is($joined2f, "1::2::3", 'join(":", @odd_list2) works');

# should these even be tests ???
Expand Down
2 changes: 0 additions & 2 deletions S32-list/map.t
Expand Up @@ -171,15 +171,13 @@ is( ~((1..3).map: { dbl( $_ ) }),'2 4 6','extern method in map');
is +@result, 4, "map works with the map body returning an empty arrayref variable";
}

#?pugs skip 'Mu'
{
my @array = <a b c d>;
my @result = map { Mu }, @array;

is +@result, 4, "map works with the map body returning undefined";
}

#?pugs skip 'Mu'
{
my @array = <a b c d>;
my $undef = Mu;
Expand Down

0 comments on commit dc27da8

Please sign in to comment.