Skip to content

Instantly share code, notes, and snippets.

@ajs
Created November 9, 2016 19:05
Show Gist options
  • Save ajs/c11a00290b52957a5f686c8ad3c60885 to your computer and use it in GitHub Desktop.
Save ajs/c11a00290b52957a5f686c8ad3c60885 to your computer and use it in GitHub Desktop.
Test program that shows classes that do not call their BUILD when subclassed
$ perl6 -e 'role Thrower { submethod BUILD(|c) { die; } }; use Test; for <Any Hash Set Int List Routine Mu> -> $name { my $type = ::($name); my $thing = $type.^mixin(Thrower); dies-ok {$thing.new }, "Expect BUILD on ({$thing.perl})" }'
ok 1 - Expect BUILD on (Any+{Thrower})
not ok 2 - Expect BUILD on (Hash+{Thrower})
# Failed test 'Expect BUILD on (Hash+{Thrower})'
# at -e line 1
not ok 3 - Expect BUILD on (Set+{Thrower})
# Failed test 'Expect BUILD on (Set+{Thrower})'
# at -e line 1
ok 4 - Expect BUILD on (Int+{Thrower})
not ok 5 - Expect BUILD on (List+{Thrower})
# Failed test 'Expect BUILD on (List+{Thrower})'
# at -e line 1
ok 6 - Expect BUILD on (Routine+{Thrower})
ok 7 - Expect BUILD on (Mu+{Thrower})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment