Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[t/spec] basic tests for dispatch on typed arrays

git-svn-id: http://svn.pugscode.org/pugs@26124 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 5e0b5ea2826ba5465b6a8ad4bdb8a0fec1b5b794 1 parent 5ebd7de
moritz authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 S06-multi/type-based.t
View
19 S06-multi/type-based.t
@@ -1,6 +1,6 @@
use v6;
use Test;
-plan 32;
+plan 35;
# type based dispatching
#
@@ -115,4 +115,21 @@ is(mmd(1..3), 2, 'Slurpy MMD to listop via list');
is f3(3), 4, '... and the ordinary dispatch still works';
}
+# multi dispatch on typed containers
+
+{
+ multi f4 (Int @a ) { 'Array of Int' }
+ multi f4 (Str @a ) { 'Array of Str' }
+ multi f4 (Array @a) { 'Array of Array' }
+
+ my Int @a = 3, 4;
+ my Str @b = <foo bar>;
+ my Array @c = [1, 2], [3, 4];
+
+ is f4(@a), 'Array of Int', 'can dispatch on typed array (Int)';
+ is f4(@b), 'Array of Str', 'can dispatch on typed array (Str)';
+ is f4(@c), 'Array of Array', 'can dispatch on typed array (Array)';
+}
+
+
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.