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

Unified Diff: test/mjsunit/harmony/typesystem/testgen.js

Issue 1817353003: Add tests for variable declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types
Patch Set: Created 4 years, 9 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
Index: test/mjsunit/harmony/typesystem/testgen.js
diff --git a/test/mjsunit/harmony/typesystem/testgen.js b/test/mjsunit/harmony/typesystem/testgen.js
index 740530d545b9baed76a42e11d51cb311ecb0da7b..752191a7c89ff2ed0fb8fed43c006c652df64914 100644
--- a/test/mjsunit/harmony/typesystem/testgen.js
+++ b/test/mjsunit/harmony/typesystem/testgen.js
@@ -4,14 +4,22 @@
var debug = false;
-function CheckValid(type) {
- if (debug) { print("V:", type); }
- assertDoesNotThrow("'use types'; var x: " + type + ";");
+function CheckValid(script) {
+ if (debug) { print("V:", script); }
+ assertDoesNotThrow("'use types'; " + script);
}
-function CheckInvalid(type) {
- if (debug) { print("I:", type); }
- assertThrows("'use types'; var x: " + type + ";", SyntaxError);
+function CheckInvalid(script, exception=SyntaxError) {
+ if (debug) { print("I:", script); }
+ assertThrows("'use types'; " + script, exception);
+}
+
+function CheckValidType(type) {
+ CheckValid("var x: " + type + ";");
+}
+
+function CheckInvalidType(type, exception=SyntaxError) {
+ CheckInvalid("var x: " + type + ";", exception);
}
// Parameters:
@@ -115,8 +123,8 @@ function* Generate(size, generators) {
//
// This function will generate all tests yielded by Generate and will
// discard the results. It will normally be called with test generators
-// whose transformation functions test for validity (e.g. CheckValid or
-// CheckInvalid) and do not return anything interesting.
+// whose transformation functions test for validity (e.g. CheckValidType
+// or CheckInvalidType) and do not return anything interesting.
function Test(size, generators) {
for (let attempt of Generate(size, generators)) continue;
}
« no previous file with comments | « test/mjsunit/harmony/typesystem/string-literal-types.js ('k') | test/mjsunit/harmony/typesystem/tuple-types.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698