Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
first basic tests for non-integer enums and enums of mixed types
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| 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' | ||
| eval_lives_ok 'my Cool enum C (a => 1, b => "bar")', | ||
| '... unles that type covers both enum value types'; | ||
|
|
||
| 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'; | ||
| } |