Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

test type checking of default values, RT #74758

  • Loading branch information...
commit 9e7fb12f462a5e7e7217cd64a2c1beb1b0196e17 1 parent 584c1a8
Moritz Lenz authored October 01, 2011
11  S06-signature/optional.t
@@ -3,7 +3,7 @@ use Test;
3 3
 
4 4
 # L<S06/Optional parameters/>
5 5
 
6  
-plan 21;
  6
+plan 23;
7 7
 
8 8
 sub opt1($p?) { defined($p) ?? $p !! 'undef'; }
9 9
 
@@ -84,4 +84,13 @@ is opt_hash2(),  0, "optional hash not passed is empty (copy)";
84 84
 eval_dies_ok 'sub opt($a = 1, $b) { }',
85 85
     'Cannot put required parameter after optional parameters';
86 86
 
  87
+# RT #74758
  88
+{
  89
+    sub opt-type1(Int $x?) { $x };
  90
+    ok opt-type1() === Int,
  91
+        'optional param with type constraints gets the right value';
  92
+    sub opt-type2(Int $x = 'str') { };
  93
+    nok eval('opt-type2()'), 'default values are type-checked';
  94
+}
  95
+
87 96
 # vim: ft=perl6
8  S12-subset/subtypes.t
@@ -214,6 +214,14 @@ ok "x" !~~ NW1, 'subset declaration without where clause rejects wrong value';
214 214
     is $*call2, 1, 'level two subset checked (should succeed)';
215 215
 }
216 216
 
  217
+# RT #75718
  218
+{
  219
+    roles R { };
  220
+    subset S of R;
  221
+    nok 1 ~~ S, 'subsets of roles (1)';
  222
+     ok R ~~ S, 'subsets of roles (2)';
  223
+}
  224
+
217 225
 done;
218 226
 
219 227
 # vim: ft=perl6
1  S14-roles/composition.t
@@ -72,6 +72,7 @@ ok rB !~~ RT64002, 'role not matched by second role it does';
72 72
 }
73 73
 
74 74
 # diamond composition
  75
+#?rakudo skip 'diamond composition'
75 76
 {
76 77
     role DA { 
77 78
         method foo { "OH HAI" };

0 notes on commit 9e7fb12

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