Skip to content

Commit

Permalink
several fixes. I've done several manual tests for get/set attr and me…
Browse files Browse the repository at this point in the history
…thods, with various with/will settings
  • Loading branch information
Whiteknight committed Mar 5, 2011
1 parent 2a3cca4 commit 23d5e5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/mockobject/Controller.winxed
Expand Up @@ -58,7 +58,7 @@ namespace Rosella { namespace MockObject
function get_attr_str(var proxy, string name)
{
for (var expect in self.expectations) {
if (expect.__can_match_get_attr()) {
if (expect.__can_match_get_attr(name)) {
expect.__match();
return expect.__run_will_behavior();
}
Expand All @@ -70,7 +70,7 @@ namespace Rosella { namespace MockObject
function set_attr_str(var proxy, string name, var value)
{
for (var expect in self.expectations) {
if (expect.type == "set_attribute" && expect.name == name && expect.__can_match_set_attr(value)) {
if (expect.__can_match_set_attr(name, value)) {
expect.__match();
expect.__run_will_behavior(); // everything besides "throw" is ignored
return;
Expand Down
4 changes: 3 additions & 1 deletion src/mockobject/Expectation.winxed
Expand Up @@ -202,10 +202,12 @@ namespace Rosella { namespace MockObject
// Do the thing we say we will
function __run_will_behavior()
{
if (self.will_behavior == null)
return null;
if (self.will_behavior == "return")
return self.will_value;
if (self.will_behavior == "throw")
die(self.will_behavior);
die(self.will_value);
return null;
}
}
Expand Down

0 comments on commit 23d5e5a

Please sign in to comment.