Skip to content

Commit

Permalink
Added some samples that would result in more then 100 percent covrage…
Browse files Browse the repository at this point in the history
… before the fix
  • Loading branch information
chrisdp committed Feb 10, 2024
1 parent bea35b5 commit 82e088e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"failFast": false,
"sendHomeOnFinish": false,
"keepAppOpen": true,
"isGlobalMethodMockingEnabled": true
"isGlobalMethodMockingEnabled": true,
"isRecordingCodeCoverage": false
},
"sourceMap": true
}
36 changes: 36 additions & 0 deletions tests/src/source/CodeCoverage.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
function hitAllStatements() as dynamic
loopCount = 0
for i = 0 to 10
loopCount++
end for

tryAgain:
if loopCount = 11 then
loopCount++
goto tryAgain
else if loopCount = 12 then
loopCount++
goto tryAgain
else
loopCount++
end if

while loopCount > 0
loopCount--
if loopCount = 1 then
exit while
end if
end while

obj = {
one: 1
}
obj["two"] = 2
obj.three = 3

for each key in obj
print obj[key]
end for

return false
end function
15 changes: 15 additions & 0 deletions tests/src/source/CodeCoverage.spec.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace tests

@suite
class CodeCovTests extends rooibos.BaseTestSuite
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@describe("Samples for validating code coverage")
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

@it("tests statements for code coverage")
function _()
m.assertFalse(hitAllStatements())
end function

end class
end namespace

0 comments on commit 82e088e

Please sign in to comment.