diff --git a/tests/bsconfig.json b/tests/bsconfig.json index ce469c4c..08ba2e32 100644 --- a/tests/bsconfig.json +++ b/tests/bsconfig.json @@ -32,7 +32,8 @@ "failFast": false, "sendHomeOnFinish": false, "keepAppOpen": true, - "isGlobalMethodMockingEnabled": true + "isGlobalMethodMockingEnabled": true, + "isRecordingCodeCoverage": false }, "sourceMap": true } \ No newline at end of file diff --git a/tests/src/source/CodeCoverage.bs b/tests/src/source/CodeCoverage.bs new file mode 100644 index 00000000..960ead89 --- /dev/null +++ b/tests/src/source/CodeCoverage.bs @@ -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 \ No newline at end of file diff --git a/tests/src/source/CodeCoverage.spec.bs b/tests/src/source/CodeCoverage.spec.bs new file mode 100644 index 00000000..67d54d35 --- /dev/null +++ b/tests/src/source/CodeCoverage.spec.bs @@ -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 \ No newline at end of file