Permalink
Browse files

[t/spec]: Use isa_ok instead of WHAT to test types.

git-svn-id: http://svn.pugscode.org/pugs@26515 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 82d9c01 commit ccbeeddd6cc7a6f20ca2e471a99e002e38611de0 pmichaud committed Apr 28, 2009
Showing with 9 additions and 9 deletions.
  1. +1 −1 S06-signature/passing-arrays.t
  2. +1 −1 S06-signature/passing-hashes.t
  3. +4 −4 S06-signature/type-capture.t
  4. +3 −3 S12-attributes/instance.t
@@ -25,7 +25,7 @@ plan 9;
{
sub pa(@a) { @a.WHAT; }
my @b = 2, 3;
- is pa(@b), 'Array', 'basic array type sanity';
+ isa_ok pa(@b), Array, 'basic array type sanity';
dies_ok { pa(3) }, 'non-slurpy array does not take a single Int';
sub ph(%h) { 1 }
@@ -14,7 +14,7 @@ sub insanity (%baloney) {
# sanity 0
my %h = 'a'..'d' Z 1..4;
-is(%h.WHAT, 'Hash', '%h is a Hash');
+isa_ok(%h.WHAT, Hash, '%h is a Hash');
#sanity 1;
sanity;
@@ -7,13 +7,13 @@ plan 7;
# L<S02/Generic types/>
# Check it captures built-in types.
-sub basic_capture(::T $x) { ~T }
-is(basic_capture(42), 'Int', 'captured built-in type');
-is(basic_capture(4.2), 'Num', 'captured built-in type');
+sub basic_capture(::T $x) { T }
+isa_ok(basic_capture(42), Int, 'captured built-in type');
+isa_ok(basic_capture(4.2), Num, 'captured built-in type');
# User defined ones too.
class Foo { }
-is(basic_capture(Foo.new), 'Foo', 'captured user defined type');
+isa_ok(basic_capture(Foo.new), Foo, 'captured user defined type');
# Check you can use captured type later in the signature.
sub two_the_same(::T $x, T $y) { 1 }
@@ -297,11 +297,11 @@ is eval('Foo7.new.attr'), 42, "default attribute value (1)";
has WHAT_test $.b is rw;
}
my $o = WHAT_test.new(a => WHAT_ref.new(), b => WHAT_test.new());
- is $o.a.WHAT, 'WHAT_ref', '.WHAT on attributes';
- is $o.b.WHAT, 'WHAT_test', '.WHAT on attributes of same type as class';
+ isa_ok $o.a.WHAT, WHAT_ref, '.WHAT on attributes';
+ isa_ok $o.b.WHAT, WHAT_test, '.WHAT on attributes of same type as class';
my $r = WHAT_test.new();
lives_ok {$r.b = $r}, 'type check on recursive data structure';
- is $r.b.WHAT, 'WHAT_test', '.WHAT on recursive data structure';
+ isa_ok $r.b.WHAT, WHAT_test, '.WHAT on recursive data structure';
}

0 comments on commit ccbeedd

Please sign in to comment.