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 46 lines (39 sloc) 1.382 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
use v6;
use Test;
plan 15;

#L<S03/Smart matching/type membership>
{
    class Dog {}
    class Cat {}
    class Chihuahua is Dog {} # i'm afraid class Pugs will get in the way ;-)
    role SomeRole { };
    class Something does SomeRole { };

    ok (Chihuahua ~~ Dog), "chihuahua isa dog";
    ok (Something ~~ SomeRole), 'something does dog';
    ok !(Chihuahua ~~ Cat), "chihuahua is not a cat";
}

# RT #71462
{
    is 'RT71462' ~~ Str, True, '~~ Str returns a Bool (1)';
    is 5 ~~ Str, False, '~~ Str returns a Bool (2)';
    is 'RT71462' ~~ Int, False, '~~ Int returns a Bool (1)';
    is 5 ~~ Int, True, '~~ Int returns a Bool (2)';
    #?pugs 2 skip 'Set'
    is 'RT71462' ~~ Set, False, '~~ Set returns a Bool (1)';
    is set(1, 3) ~~ Set, True, '~~ Set returns a Bool (2)';
    #?pugs 2 skip 'Numeric'
    is 'RT71462' ~~ Numeric, False, '~~ Numeric returns a Bool (1)';
    is 5 ~~ Numeric, True, '~~ Numeric returns a Bool (2)';
    #?pugs 2 skip 'Callable'
    is &say ~~ Callable, True, '~~ Callable returns a Bool (1)';
    is 5 ~~ Callable, False, '~~ Callable returns a Bool (2)';
}

# RT 76610
{
    module M { };
    #?niecza todo "Unable to resolve method ACCEPTS in type M"
    lives_ok { 42 ~~ M }, '~~ module lives';
    ok not $/, '42 is not a module';
}

done;

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