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 29 lines (20 sloc) 1.123 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
use v6;
use Test;

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

plan 8;

eval_lives_ok q[ class StubA { ... }; class StubA { method foo { } }; ],
              'Can stub a class, and later on declare it';
eval_lives_ok q[ role StubB { ... }; role StubB { method foo { } }; ],
              'Can stub a role, and later on declare it';
eval_lives_ok q[ module StubC { ... }; module StubC { sub foo { } }; ],
              'Can stub a module, and later on declare it';

#?niecza todo 'broken in nom-derived stub model'
#?rakudo todo 'nom regression'
eval_lives_ok q[ package StubD { ... }; class StubD { method foo { } }; ],
              'Can stub a package, and later on implement it as a method';

# not quite class stubs, but I don't know where else to put the tests...

lives_ok { sub {...} }, 'not execued stub code is fine';
dies_ok { (sub {...}).() ~ '' }, 'execued stub code goes BOOM when used';
dies_ok { use fatal; (sub { ... }).() }, 'exeucted stub code goes BOOM under fatal';

eval_dies_ok q[my class StubbedButNotDeclared { ... }], 'stubbing a class but not providing a definition dies';

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