Index: test/cctest/test-asm-validator.cc |
diff --git a/test/cctest/test-asm-validator.cc b/test/cctest/test-asm-validator.cc |
index 1149d19f241a408bc48bf520ceb326bdf40ab8a4..fae75008c70c06892aea0f8909afea1a94995973 100644 |
--- a/test/cctest/test-asm-validator.cc |
+++ b/test/cctest/test-asm-validator.cc |
@@ -2024,3 +2024,27 @@ TEST(SwitchTest) { |
} |
CHECK_FUNC_TYPES_END |
} |
+ |
+ |
+TEST(BadSwitchRange) { |
+ CHECK_FUNC_ERROR( |
+ "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n" |
+ "function foo() { bar(); }", |
+ "asm: line 39: case range too large\n"); |
+} |
+ |
+ |
+TEST(DuplicateSwitchCase) { |
+ CHECK_FUNC_ERROR( |
+ "function bar() { switch (1) { case 0: case 0: } }\n" |
+ "function foo() { bar(); }", |
+ "asm: line 39: duplicate case value\n"); |
+} |
+ |
+ |
+TEST(BadSwitchOrder) { |
+ CHECK_FUNC_ERROR( |
+ "function bar() { switch (1) { default: case 0: } }\n" |
+ "function foo() { bar(); }", |
+ "asm: line 39: default case out of order\n"); |
+} |