Index: test/mjsunit/strong/classes.js |
diff --git a/test/mjsunit/strong/classes.js b/test/mjsunit/strong/classes.js |
index 3c7caf5f84e4a5d31ac3519d975816a4be05ae8b..716fc0ff8ebfc83b0dc73ce1428ba1827344fad4 100644 |
--- a/test/mjsunit/strong/classes.js |
+++ b/test/mjsunit/strong/classes.js |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
// Flags: --strong-mode |
+// Flags: --harmony-classes --harmony-arrow-functions |
'use strong'; |
@@ -15,3 +16,36 @@ class C {} |
assertEquals('function', typeof C); |
assertEquals('function', typeof D); |
})(); |
+ |
+function constructor(body) { |
+ return "'use strong'; " + |
+ "(class extends Object { constructor() { " + body + " } })"; |
+} |
+ |
+(function NoMissingSuper() { |
+ let bodies = [ |
+ "", |
+ "1;" |
+ ]; |
+ for (let b of bodies) assertThrows(constructor(b), SyntaxError); |
marja
2015/03/13 15:21:20
Nit: this style of writing tests will give less us
|
+})(); |
+ |
+(function NoNestedSuper() { |
+ let bodies = [ |
+ "(super())", |
+ "(() => super())(); } })", |
+ "{ super();", |
+ "if (1) super();", |
+ ]; |
+ for (let b of bodies) assertThrows(constructor(b), SyntaxError); |
+})(); |
+ |
+(function NoDuplicateSuper() { |
+ let bodies = [ |
+ "super(), super();", |
+ "super(); super();", |
+ "super(); (super());", |
+ "super(); { super() }", |
+ ]; |
+ for (let b of bodies) assertThrows(constructor(b), SyntaxError); |
+})(); |