Skip to content

Commit

Permalink
Test all yadas work to stub classes
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Sep 16, 2016
1 parent 968764e commit 0ade2a5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion S12-class/stubs.t
Expand Up @@ -3,7 +3,7 @@ use Test;

# L<S12/Classes/You can predeclare a stub class>

plan 10;
plan 11;

eval-lives-ok q[ class StubA { ... }; class StubA { method foo { } }; ],
'Can stub a class, and later on declare it';
Expand Down Expand Up @@ -37,4 +37,24 @@ throws-like q[my class StubbedButNotDeclared { ... }], X::Package::Stubbed,
parent-name => 'A';
}

# RT #129270
subtest "all forms of yadas work to stub classes" => {
plan 2;
subtest "lives when stubbed, then defined" => {
plan 4;
eval-lives-ok my class Foo { … }; my class Foo {}, '';
eval-lives-ok my class Foo { ... }; my class Foo {}, '...';
eval-lives-ok my class Foo { !!! }; my class Foo {}, '!!!';
eval-lives-ok my class Foo { ??? }; my class Foo {}, '???';
}

subtest "throws when stubbed, and never defined" => {
plan 4;
throws-like my class Foo { … }, X::Package::Stubbed, '';
throws-like my class Foo { ... }, X::Package::Stubbed, '...';
throws-like my class Foo { !!! }, X::Package::Stubbed, '!!!';
throws-like my class Foo { ??? }, X::Package::Stubbed, '???';
}
}

# vim: ft=perl6

0 comments on commit 0ade2a5

Please sign in to comment.