Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion resources/assert_lib.brs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@ function __roca_deepEquals(lhs as object, rhs as object) as boolean
index = 0
for each updatedLeft in lhs
updatedRight = rhs[index]

isEqual = __roca_deepEquals(updatedLeft, updatedRight)

if type(updatedRight) <> "roAssociativeArray" and type(updatedRight) <> "roArray" then
isEqual = (updatedLeft = updatedRight)
end if

if not isEqual then return false

index++
Expand Down
24 changes: 24 additions & 0 deletions test/e2e/assert/assert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ describe("assert", () => {
{ fullTitle: "hasBeenCalledWith success complex arg" },
{ fullTitle: "hasBeenCalledWith success multiple args" },
{ fullTitle: "hasBeenCalledWith success multiple calls" },
{ fullTitle: "hasBeenCalledWith success boolean true value" },
{ fullTitle: "hasBeenCalledWith success boolean false value" },
]);

expect(results.failures).toMatchObject([
Expand Down Expand Up @@ -108,6 +110,28 @@ describe("assert", () => {
name: "m.assert.hasBeenCalledWith",
},
},
{
fullTitle:
"hasBeenCalledWith failure boolean values, which do not match(true/false)",
err: {
actual: "(true)",
expected: "(false)",
message:
"Expected mock function 'fakeFunc' to have been called with args (false)",
name: "m.assert.hasBeenCalledWith",
},
},
{
fullTitle:
"hasBeenCalledWith failure boolean values, which do not match(false/true)",
err: {
actual: "(false)",
expected: "(true)",
message:
"Expected mock function 'fakeFunc' to have been called with args (true)",
name: "m.assert.hasBeenCalledWith",
},
},
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ function main(args as object) as object
m.assert.hasBeenCalledWith(m.spy, ["bar"])
m.assert.hasBeenCalledWith(m.spy, ["baz"])
end sub)

m.it("boolean true value", sub()
fakeFunc(true)
m.assert.hasBeenCalledWith(m.spy, [true])
end sub)

m.it("boolean false value", sub()
fakeFunc(false)
m.assert.hasBeenCalledWith(m.spy, [false])
end sub)
end sub)

m.describe("failure", sub()
Expand Down Expand Up @@ -60,6 +70,16 @@ function main(args as object) as object
fakeFunc([], 456)
m.assert.hasBeenCalledWith(m.spy, [["baz"], 456])
end sub)

m.it("boolean values, which do not match(true/false)", sub()
fakeFunc(true)
m.assert.hasBeenCalledWith(m.spy, [false])
end sub)

m.it("boolean values, which do not match(false/true)", sub()
fakeFunc(false)
m.assert.hasBeenCalledWith(m.spy, [true])
end sub)
end sub)
end sub)
end function
Expand Down