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

Unified Diff: test/webkit/class-syntax-call.js

Issue 1109783003: Import JSC class tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 8 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 | « test/webkit/class-constructor-return-expected.txt ('k') | test/webkit/class-syntax-call-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « test/webkit/class-constructor-return-expected.txt ('k') | test/webkit/class-syntax-call-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698