Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 51 lines (36 sloc) 1.365 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
use v6;

use Test;

plan 10;

# L<S06/"Multidimensional argument list binding">

sub get_multidim_arglist (**@AoA) { @AoA }

{
    my @array1 = <a b c>;
    my @array2 = <d e f>;

    my @AoA = get_multidim_arglist(@array1; @array2);
    is +@AoA, 2, "basic multidim arglist binding (1)";
    is ~@AoA[0], "a b c", "basic multidim arglist binding (2)";
    is ~@AoA[1], "d e f", "basic multidim arglist binding (3)";
}

{
    my @array1 = <a b c>;

    my @AoA = get_multidim_arglist(@array1);
    is +@AoA, 1, "multidim arglist binding with only one array (1)";
    is ~@AoA[0], "a b c", "multidim arglist binding with only one array (2)";
}

multi sub multi_get_multidim_arglist(**@AoA) { @AoA }
multi sub multi_get_multidim_arglist(Int $a) { $a }

{
    my @a1 = <a b c>;
    my @a2 = <d e f>;

    my @AoA = multi_get_multidim_arglist(@a1; @a2);
    is +@AoA, 2, "multi sub with multidim arglist binding (1)";
    is @AoA[0], "a b c", "multi sub with multidim arglist binding (2)";
    is @AoA[1], "d e f", "multi sub with multidim arglist binding (3)";
}

{
    my @a1 = <a b c>;

    my @AoA = multi_get_multidim_arglist(@a1);
    is +@AoA, 1, "multi sub with multidim arglist binding for only one array (1)";
    is @AoA[0], "a b c", "multi sub with multidim arglist binding for only one array (2)";
}

# vim: ft=perl6
Something went wrong with that request. Please try again.