Skip to content

Commit

Permalink
adds additinoaly testing to ensure that there were no regressions on …
Browse files Browse the repository at this point in the history
…non-overloaded expects mixed with overloaded ones
  • Loading branch information
George Cook committed Mar 21, 2019
1 parent 5ca22be commit 9d0015c
Showing 1 changed file with 79 additions and 1 deletion.
80 changes: 79 additions & 1 deletion frameworkTests/source/tests/AssertionTests.brs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function Simp_expect_multiExpect_success_oneCallsArgsNotTracked()

result = obj.mockMethod(arg1)
m.AssertEqual(result, result1)

result = obj.mockMethod("do not care about args", "used in invocation", 2)
m.AssertEqual(result, result2)

Expand Down Expand Up @@ -435,6 +435,84 @@ function Simp_expect_multiExpect_multi_args_success()

end function

'@Test multi test, multi params with other expects
function Simp_expect_multiExpect_multi_args_others_success()
obj = {}
arg1 = "arg1"
arg2 = "arg2"
arg3 = "arg3"
result1 = 1
result2 = 2
result3 = 3

m.expectOnce(obj, "anotherMockMethod", invalid, "another", true)
m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true)
m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true)
m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true)
m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true)

result = obj.anotherMockMethod()
m.AssertEqual(result, "another")

result = obj.anotherMockMethod2(1, 2, 3)
m.AssertEqual(result, "another2")

result = obj.mockMethod(arg1, arg2, arg3)
m.AssertEqual(result, result)

result = obj.mockMethod(arg2, arg3, arg1)
m.AssertEqual(result, result2)

result = obj.mockMethod(arg3, arg2, arg1)
m.AssertEqual(result, result3)

m.assertMocks()
isFail = m.currentResult.isFail

m.currentResult.Reset()
m.AssertFalse(isFail)

end function

'@Test multi test, multi params with other expects - fail others
function Simp_expect_multiExpect_multi_args_others_fail()
obj = {}
arg1 = "arg1"
arg2 = "arg2"
arg3 = "arg3"
result1 = 1
result2 = 2
result3 = 3

m.expectOnce(obj, "anotherMockMethod", ["not passed"], "another", true)
m.expectOnce(obj, "anotherMockMethod2", [1,2,3], "another2", true)
m.expectOnce(obj, "mockMethod", [arg1, arg2, arg3], result1, true)
m.expectOnce(obj, "mockMethod", [arg2, arg3, arg1], result2, true)
m.expectOnce(obj, "mockMethod", [arg3, arg2, arg1], result3, true)

result = obj.anotherMockMethod()
m.AssertEqual(result, "another")

result = obj.anotherMockMethod2(1, 2, 3)
m.AssertEqual(result, "another2")

result = obj.mockMethod(arg1, arg2, arg3)
m.AssertEqual(result, result)

result = obj.mockMethod(arg2, arg3, arg1)
m.AssertEqual(result, result2)

result = obj.mockMethod(arg3, arg2, arg1)
m.AssertEqual(result, result3)

m.assertMocks()
isFail = m.currentResult.isFail

m.currentResult.Reset()
m.AssertTrue(isFail)

end function

'@Test can set up multi expects on same method
'@Params["arg1_", "arg2", "arg3"]
'@Params["arg1", "arg2", "arg3_"]
Expand Down

0 comments on commit 9d0015c

Please sign in to comment.