summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2015-07-03 04:45:14 +0800
committerSam Spilsbury <smspillaz@gmail.com>2015-07-03 04:45:14 +0800
commit08721686fe772a21e26633b03783264147f2212c (patch)
tree6483ac4854eab68621280a08b42a0694638a8914
parent9ae78c152a085d5aae4ae43ee4f82e2d8c0675fb (diff)
downloadgjs-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.js16
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" +