Index: test/webkit/class-syntax-call.js |
diff --git a/test/webkit/array-indexing.js b/test/webkit/class-syntax-call.js |
similarity index 61% |
copy from test/webkit/array-indexing.js |
copy to test/webkit/class-syntax-call.js |
index d4e751bf1e6a117cf25523b7d500d228c58413c9..3cf82a889985b0d109e632328d6753dd6b83a10f 100644 |
--- a/test/webkit/array-indexing.js |
+++ b/test/webkit/class-syntax-call.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 the V8 project authors. All rights reserved. |
+// Copyright 2015 the V8 project authors. All rights reserved. |
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
// |
// Redistribution and use in source and binary forms, with or without |
@@ -21,17 +21,20 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-description( |
-"This test checks that array accessing doesn't do the wrong thing for negative indices" |
-); |
-var a = []; |
-a[-5] = true; |
-shouldBe('a.length', '0'); |
-shouldBe('a["-5"]', 'a[-5]'); |
+// Flags: --harmony-sloppy |
-// Just some bounds paranoia |
-a = [1,2,3,4]; |
-shouldBe('a[4]', 'undefined'); |
+description('Tests for calling the constructors of ES6 classes'); |
-a = []; |
-for (var i = 0; i > -1000; i--) a[i] = i; |
+class A { constructor() {} }; |
+class B extends A { constructor() { super() } }; |
+ |
+shouldNotThrow('new A'); |
+shouldThrow('A()', '"TypeError: Class constructors cannot be invoked without \'new\'"'); |
+shouldNotThrow('new B'); |
+shouldThrow('B()', '"TypeError: Class constructors cannot be invoked without \'new\'"'); |
+shouldNotThrow('new (class { constructor() {} })()'); |
+shouldThrow('(class { constructor() {} })()', '"TypeError: Class constructors cannot be invoked without \'new\'"'); |
+shouldThrow('new (class extends null { constructor() { super() } })()', '"TypeError: function () {} is not a constructor"'); |
+shouldThrow('(class extends null { constructor() { super() } })()', '"TypeError: Class constructors cannot be invoked without \'new\'"'); |
+ |
+var successfullyParsed = true; |