Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flesh out several tests for action library. Move ContainerResolver te…
…st file (mostly stubbish) to the t/container folder
- Loading branch information
1 parent
e81c44c
commit 3156f57
Showing
7 changed files
with
113 additions
and
31 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
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
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
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 |
---|---|---|
@@ -1,13 +1,49 @@ | ||
INIT { | ||
pir::load_bytecode("rosella/test.pbc"); | ||
pir::load_bytecode("rosella/action.pbc"); | ||
pir::load_bytecode("rosella/mockobject.pbc"); | ||
} | ||
|
||
Rosella::Test::test(ActionMethodTest); | ||
|
||
class MyTargetType { method test() { } } | ||
|
||
class ActionMethodTest { | ||
method test_BUILD() { | ||
my $action := Rosella::build(Rosella::Action::Method, "test", []); | ||
my $action := Rosella::build(Rosella::Action::Method, "test"); | ||
Assert::instance_of($action, Rosella::Action::Method, "Is not a Method"); | ||
} | ||
|
||
method execute() { | ||
my $action := Rosella::build(Rosella::Action::Method, "test"); | ||
my $mockfactory := Rosella::build(Rosella::MockObject::Factory); | ||
my $controller := $mockfactory.create_typed(MyTargetType); | ||
$controller.expect_method("test").once.with_no_args; | ||
my $target := $controller.mock; | ||
$action.execute($target); | ||
$controller.verify; | ||
} | ||
|
||
method execute_initializer() { | ||
my $action := Rosella::build(Rosella::Action::Method, "test"); | ||
my $mockfactory := Rosella::build(Rosella::MockObject::Factory); | ||
my $controller := $mockfactory.create_typed(MyTargetType); | ||
$controller.expect_method("test").once.with_no_args; | ||
my $target := $controller.mock; | ||
$action.execute_initializer($target, [], {}); | ||
$controller.verify; | ||
} | ||
|
||
method execute_initializer_args() { | ||
my $action := Rosella::build(Rosella::Action::Method, "test"); | ||
my $mockfactory := Rosella::build(Rosella::MockObject::Factory); | ||
my $controller := $mockfactory.create_typed(MyTargetType); | ||
$controller.expect_method("test").once.with_args(1, 2, 3, :foo("A"), :bar("B")); | ||
my $target := $controller.mock; | ||
my %named := {}; | ||
%named{"foo"} := "A"; | ||
%named{"bar"} := "B"; | ||
$action.execute_initializer($target, [1, 2, 3], %named); | ||
$controller.verify; | ||
} | ||
} |
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
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
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