Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a unit test to ensure that gotoState properly passes additional a…

…rguments to enteredState and exitedState
  • Loading branch information...
commit 37ffe032fd1ed8afcec166d6de8b93e55aa6ad0d 1 parent e697f87
@TannerRogalsky TannerRogalsky authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 spec/unit.lua
View
11 spec/unit.lua
@@ -104,6 +104,17 @@ describe("Unit tests", function()
assert_true(e.mark)
end)
+ it("passes all additional arguments to enteredState and exitedState", function()
+ local FooEnemy = Enemy:addState("FooEnemy")
+ local testValue = "Bar"
+
+ local validateVarargs = function(self, ...) assert_equal(..., testValue) end
+ FooEnemy.enteredState = validateVarargs
+ FooEnemy.exitedState = validateVarargs
+
+ local e = Enemy:new()
+ e:gotoState("FooEnemy", testValue)
+ end)
end)
it("raises an error when given an invalid id", function()
Please sign in to comment.
Something went wrong with that request. Please try again.