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 35 lines (24 sloc) 0.672 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
use v6;

use Test;

plan 8;

=begin pod

Parameterized traits tests, see L<S14/Traits>.

=end pod

# L<S14/Traits>
# Basic definition
role cool {
    has $.cool;

    multi sub trait_auxiliary:<is>(cool $trait, Any $container; $val) { #OK not used
        $.cool = $val;
        $container does cool($val);
    }
}

my $a = 42;
is $a, 42, "basic sanity (1)";
lives_ok {$a does cool(23)}, "imperative does worked (1)";
is $a.cool, 23, "attribute was set correctly (1)";

my $b = 23;
is $b, 23, "basic sanity (2)";
ok $b does cool("hi"), "imperative does worked (2)";
is $b.cool, "hi", "attribute was set correctly (2)";

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