Skip to content

Commit

Permalink
Merge branch 'master' of github.com:georgejecook/rooibos
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook committed Jun 13, 2022
2 parents ac34aca + 8800013 commit 670ce5b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions framework/src/source/BaseTestSuite.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,23 +1121,26 @@ namespace rooibos

end function

function assertClass(value, typeStr, msg = "") as dynamic
function assertClass(value, func, msg = "") as dynamic
if m.currentResult.isFail
return false
end if
if rooibos.Common.isFunction(func)
func = value.toStr().mid(10).replace("_", ".")
end if
try
if not Rooibos.Common.isAssociativeArray(value)
if msg = ""
expr_as_string = Rooibos.Common.asString(value)
msg = expr_as_string + " was not an aa, so could not match Class " + typeStr
msg = expr_as_string + " was not an aa, so could not match Class " + func
end if
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
end if
className = `${value.__classname}`
if className <> typeStr
if className <> func
if msg = ""
msg = `Expected class: ${typeStr} got ${className}`
msg = `Expected class: ${func} got ${className}`
end if
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
Expand Down

0 comments on commit 670ce5b

Please sign in to comment.