Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2c74a240a5
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 27 lines (21 sloc) 0.632 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
use v6;
use Test;
plan 6;

{
    my enum A (a => 'foo', b => 'bar');
    is a.Str, 'foo', 'stringy enum first value';
    is b.Str, 'bar', 'stringy enum first value';
}

eval_dies_ok 'my enum B (a => 1, b => "bar")',
             'mixed type enums are forbidden';

#?rakudo todo 'NYI'
#?niecza todo
eval_lives_ok 'my Cool enum C (a => 1, b => "bar")',
             '... unles that type covers both enum value types';

#?niecza todo
eval_dies_ok 'my Str enum D (a => 1)',
             'violating an explict type constraint dies';

{
    my enum E ( a => 'x', 'b');
    is E::b.Str, 'y', 'Str enum correctly uses string-increment';
}
Something went wrong with that request. Please try again.