Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Unified Diff: test/cctest/test-asm-validator.cc

Issue 1578963003: Enforce asm restrictions on switch more precisely. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
+}
« no previous file with comments | « src/typing-asm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698