diff options
author | Sam Spilsbury <smspillaz@gmail.com> | 2015-07-03 04:45:14 +0800 |
---|---|---|
committer | Sam Spilsbury <smspillaz@gmail.com> | 2015-07-03 04:45:14 +0800 |
commit | 08721686fe772a21e26633b03783264147f2212c (patch) | |
tree | 6483ac4854eab68621280a08b42a0694638a8914 | |
parent | 9ae78c152a085d5aae4ae43ee4f82e2d8c0675fb (diff) | |
download | gjs-08721686fe772a21e26633b03783264147f2212c.tar.gz |
coverage: Test for strings in case statements
Add test to check that strings in case statements are not
executed in most cases.
-rw-r--r-- | installed-tests/js/testCoverage.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/installed-tests/js/testCoverage.js b/installed-tests/js/testCoverage.js index 522e1028..0b1aab8f 100644 --- a/installed-tests/js/testCoverage.js +++ b/installed-tests/js/testCoverage.js @@ -173,6 +173,22 @@ function testExpressionLinesFoundForCaseStatementsCharacters() { JSUnit.assertEquals); } +function testExpressionLinesFoundForCaseStatementsCharacters() { + let foundLinesInsideCaseStatements = + parseScriptForExpressionLines("var a = 'a';\n" + + "switch (a) {\n" + + "case 'a':\n" + + " a++;\n" + + " break;\n" + + "case 'b':\n" + + " a++;\n" + + " break;\n" + + "}\n"); + assertArrayEquals(foundLinesInsideCaseStatements, + [1, 2, 4, 5, 7, 8], + JSUnit.assertEquals); +} + function testExpressionLinesFoundForLoop() { let foundLinesInsideLoop = parseScriptForExpressionLines("for (let i = 0; i < 1; i++) {\n" + |