Skip to content

Commit

Permalink
fix(asserts): fixes logic error in assertclass (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook authored Jun 13, 2022
1 parent 5252308 commit a3e4c42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions framework/src/source/BaseTestSuite.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ namespace rooibos
return false
end if
if rooibos.Common.isFunction(func)
func = value.toStr().mid(10).replace("_", ".")
func = func.toStr().mid(10).replace("_", ".")
end if
try
if not Rooibos.Common.isAssociativeArray(value)
Expand All @@ -1137,8 +1137,8 @@ namespace rooibos
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
end if
className = `${value.__classname}`
if className <> func
className = lCase(`${value.__classname}`)
if className <> lCase(func)
if msg = ""
msg = `Expected class: ${func} got ${className}`
end if
Expand Down
12 changes: 12 additions & 0 deletions tests/src/source/Basic.spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ namespace tests
m.assertFalse(isFail)
end function

@it("passes If Is correct Class as reference")
function _()
m.assertClass({
__classname: "rooibos.BaseTestSuite"
}, rooibos.BaseTestSuite)
isFail = m.currentResult.isFail

m.currentResult.Reset()

m.assertFalse(isFail)
end function

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@describe("assertAAContainsSubset")
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down

0 comments on commit a3e4c42

Please sign in to comment.