Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

git-svn-id: http://svn.pugscode.org/pugs@26514 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 82d9c0166b7fa16e8413e5dfdb9a7c7512f1ecec 1 parent e26ca55
authored April 28, 2009
4  S12-class/attributes.t
@@ -65,7 +65,7 @@ class Foo {
65 65
     }
66 66
 }
67 67
 my $foo = Foo.new;
68  
-is(~$foo.bar.WHAT, 'Hash', 'hash attribute initialized');
  68
+isa_ok($foo.bar.WHAT, Hash, 'hash attribute initialized');
69 69
 $foo.set_bar();
70 70
 is($foo.bar<a>, 'baz',    'hash attribute initialized/works');
71 71
 my %s = $foo.bar;
@@ -81,7 +81,7 @@ class Bar {
81 81
     }
82 82
 }
83 83
 my $bar = Bar.new;
84  
-is(~$bar.bar.WHAT, 'Array', 'array attribute initialized');
  84
+isa_ok($bar.bar.WHAT, Array, 'array attribute initialized');
85 85
 $bar.set_bar();
86 86
 is($bar.bar[0], 100,       'array attribute initialized/works');
87 87
 is($bar.bar[1], 200,       'array attribute initialized/works');
2  S12-methods/what.t
@@ -57,6 +57,6 @@ plan 14;
57 57
     # proto as a term
58 58
     lives_ok {  Match }, 'proto as a term lives';
59 59
     lives_ok { +Match }, 'numification of proto lives';
60  
-    is ~("bac" ~~ /a/).WHAT, 'Match', '.WHAT on a Match works';
  60
+    isa_ok ("bac" ~~ /a/).WHAT, Match, '.WHAT on a Match works';
61 61
     is +("bac" ~~ /a/).WHAT, 0, 'numification of .WHAT of a Match works';
62 62
 }
6  S12-role/parameterized-type.t
@@ -13,7 +13,7 @@ Tests for using parameterized roles as types, plus the of keyword.
13 13
 #?pugs emit skip_rest('parameterized roles'); exit;
14 14
 #?pugs emit =begin SKIP
15 15
 
16  
-role R1[::T] { method x { ~T } }
  16
+role R1[::T] { method x { T } }
17 17
 class C1 does R1[Int] { }
18 18
 class C2 does R1[Str] { }
19 19
 
@@ -23,9 +23,9 @@ lives_ok { my R1 of Int $x = R1[Int].new }, 'using of as type constraint on vari
23 23
 dies_ok  { my R1 of Int $x = R1[Str].new }, 'using of as type constraint on variable works (role instantiation)';
24 24
 
25 25
 sub param_test(R1 of Int $x) { $x.x }
26  
-is param_test(C1.new),      'Int',          'using of as type constraint on parameter works (class does role)';
  26
+isa_ok param_test(C1.new),      Int,          'using of as type constraint on parameter works (class does role)';
27 27
 dies_ok { param_test(C2.new) },             'using of as type constraint on parameter works (class does role)';
28  
-is param_test(R1[Int].new), 'Int',          'using of as type constraint on parameter works (role instantiation)';
  28
+isa_ok param_test(R1[Int].new), Int,          'using of as type constraint on parameter works (role instantiation)';
29 29
 dies_ok { param_test(R1[Str].new) },        'using of as type constraint on parameter works (role instantiation)';
30 30
 
31 31
 role R2[::T] {

0 notes on commit 82d9c01

Please sign in to comment.
Something went wrong with that request. Please try again.