Permalink
Browse files

[t/spec]: Fudge and fix some tests after autoviv changes.

git-svn-id: http://svn.pugscode.org/pugs@31555 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 3e60057 commit d5fdcaf3e10fe9065516427f45e2315dc102050a pmichaud committed Jul 6, 2010
@@ -15,11 +15,13 @@ plan 10;
my $ref = { val => 42 };
#?rakudo todo 'Hash.isa(Hash)'
isa_ok($ref, Hash);
+#?rakudo todo "die or fail?"
dies_ok { $ref[0] }, 'Hash !~~ Positional';
{
$ref = [ 42 ];
isa_ok($ref, Array);
+ #?rakudo todo "die or fail?"
dies_ok( { $ref<0> }, 'Accessing an array as a hash dies');
}
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 34;
+plan 33;
{
my @array = 11 .. 15;
@@ -13,8 +13,6 @@ plan 34;
# 3[0] etc. should *not* work, but (3,)[0] should.
# That's similar as with the .kv issue we've had: 3.kv should fail, but
# (3,).kv should work.
- #?pugs todo 'bug'
- dies_ok({@array[0][0]}, 'scalar is not implicitly array');
}
{
@@ -146,8 +146,8 @@ test2 %hash;
sub test3 (%h){
for %h.pairs -> $pair {
isa_ok($pair,Pair);
- dies_ok({$pair[0]}, 'sub test3: access by $pair[0] should not work');
- dies_ok({$pair[1]}, 'sub test3: access by $pair[1] should not work');
+ isa_ok($pair[0], Pair, 'sub test3: $pair[0] is $pair');
+ ok $pair[1] ~~ Failure, 'sub test3: $pair[1] is failure');
}
}
test3 %hash;
@@ -23,7 +23,7 @@ my $s = join |<< <a x y z>;
is($s, "xayaz", 'listop |<< <list>');
}
-dies_ok { [1,2,3].join<a b c> }, '.join<abc> parses but semantic error';
+ok [1,2,3].join<abc> ~~ Failure, '.join<abc> parses but produces failure';
my @y = try { ({:a<1>, :b(2)}<a b c>) };
#?rakudo todo 'unknown errors'
@@ -124,6 +124,7 @@ plan 23;
is (%h<foo> *= 23), 23, '*= autovivifies with correct neutral element (without proto on hash items)';
}
+#?rakudo skip "Any.match not yet defined (Any vs Cool)"
{
my @empty;
is +@empty, 0, 'Sanity: empty array, @empty, has 0 elements';
@@ -31,6 +31,7 @@ ok($foo eq "", "Any eq ''");
ok($foo ne "f", "Any ne 'f'");
my @foo;
+#?rakudo todo "Any.Stringy"
ok(@foo[0] eq "", "Array Any eq ''");
ok(@foo[0] ne "f", "Array Any ne 'f'");
@@ -221,9 +221,8 @@ character classes), and those are referenced at the correct spot.
{
ok('1./:"{}=-' ~~ /^[<!alpha> .]+$/, '<!alpha> matches non-letter characters');
ok(!('abcdef' ~~ /<!alpha>./), '<!alpha> does not match letter characters');
- #?rakudo todo '<!before>'
- is(+('.2 1' ~~ /<!before \.> \d/), 1, '<!before>');
- is +$/.keys, 0, '<!before \\.> does not capture';
+ is(+('.2 1' ~~ /<!before 2> \d/), 1, '<!before>');
+ is +$/.caps, 0, '<!before 2> does not capture';
}
# A leading ? indicates a positive zero-width assertion
@@ -38,6 +38,7 @@ is &both.signature, :(Mu *@_, Mu *%_),
'signature is :(Mu *@_, Mu *%_) when none is specified and @_ and %_ are used';
is both( 'x', :delta<echo>, 'foxtrot' ), 'foxtrotecho',
'can call sub with both named and positional params used';
+#?rakudo todo 'undef Stringy'
is both(), '',
'sub using both named and position params works with no params';
@@ -458,7 +458,7 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
is $o.a.join('|'), '2|3|4|5',
'... all of the above actually worked (not only lived)';
- #?rakudo 3 todo 'typed arrays'
+ #?rakudo 4 todo 'typed arrays'
dies_ok { $o.a = <foo bar> }, 'type enforced on array attrib (assignment)';
dies_ok { $o.a[2] = $*IN }, 'type enforced on array attrib (item assignment)';
dies_ok { $o.a.push: [2, 3]}, 'type enforced on array attrib (push)';
@@ -476,12 +476,11 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
is_deeply $o.h<a b c d>, (1, 2, 3, 4), '... all of them worked';
- #?rakudo 3 todo 'typed hash'
+ #?rakudo 5 todo 'typed hash'
dies_ok {$o.h = { :a<b> } }, 'Type enforced (hash, assignment)';
dies_ok {$o.h<a> = 'b' }, 'Type enforced (hash, insertion)';
dies_ok {$o.h.push: (g => 'f') }, 'Type enforced (hash, push)';
dies_ok {$o.h<blubb><bla> = 3 }, 'No autovivification (typed hash)';
- #?rakudo todo 'typed hash'
is_deeply $o.h<a b c d>, (1, 2, 3, 4), 'hash still unchanged';
}
View
@@ -9,7 +9,7 @@ Push tests
=end description
-plan 51;
+plan 50;
# basic push tests
{
@@ -130,7 +130,6 @@ plan 51;
# This one is okay, as push will push 0 elems to a rw arrayref.
lives_ok({ push([]) }, 'push() requires arguments (2)');
dies_ok({ 42.push(3) }, '.push should not work on scalars');
- dies_ok({ my @r; @r.push<hi>; }, '.push<hi> should emit error.');
}
# Push with Inf arrays (waiting on answers to perl6-compiler email)

0 comments on commit d5fdcaf

Please sign in to comment.