Skip to content

Commit

Permalink
improves stringand float comparisons and assert not invalid message (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejecook authored Jan 6, 2022
1 parent ef9d022 commit b6dde0f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
2 changes: 1 addition & 1 deletion framework/src/source/BaseTestSuite.bs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ namespace rooibos
if value = invalid
if msg = ""
expr_as_string = Rooibos.Common.asString(value)
msg = expr_as_string + " = Invalid"
msg = "Expected value, got invalid"
end if
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
Expand Down
19 changes: 5 additions & 14 deletions framework/src/source/CommonUtils.bs
Original file line number Diff line number Diff line change
Expand Up @@ -595,30 +595,21 @@ namespace rooibos.Common
return false
end if

if val1Type = "roString" or val1Type = "String"
Value1 = Rooibos.Common.asString(Value1)
else
Value1 = box(Value1)
end if

if val2Type = "roString" or val2Type = "String"
Value2 = Rooibos.Common.asString(Value2)
else
Value2 = box(Value2)
end if
v1IsString = val1Type = "roString" or val1Type = "String"
v2IsString = val2Type = "roString" or val2Type = "String"
'update types after boxing
val1Type = type(Value1)
val2Type = type(Value2)


'Upcast int to float, if other is float
if val1Type = "roFloat" and val2Type = "roInt"
Value2 = box(Cdbl(Value2))
Value2 = cdbl(Value2)
else if val2Type = "roFloat" and val1Type = "roInt"
Value1 = box(Cdbl(Value1))
Value1 = cdbl(Value1)
end if

if val1Type <> val2Type
if val1Type <> val2Type and v1IsString <> v2IsString
return false
else
valtype = val1Type
Expand Down
22 changes: 8 additions & 14 deletions tests/bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
{
"rootDir": "src",
"files": [
"manifest",
"source/**/*.*",
"components/**/*.*"
],
"files": ["manifest", "source/**/*.*", "components/**/*.*"],
"autoImportComponentScript": true,
"createPackage": false,
"stagingFolderPath": "build",
"diagnosticFilters": [
{
"src": "**/roku_modules/**/*.*",
"codes": [
1107,
1009
]
"codes": [1107, 1009]
}
],
"plugins": [
"../bsc-plugin/dist/plugin.js"
],
"plugins": ["../bsc-plugin/dist/plugin.js"],
"rooibos": {
"showOnlyFailures": true,
"lineWidth": 70
"catchCrashes": true,
"lineWidth": 70,
"failFast": false,
"sendHomeOnFinish": false
},
"sourceMap": true
}
}

0 comments on commit b6dde0f

Please sign in to comment.