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

Unified Diff: test/intl/not-constructors.js

Issue 2587713002: [intl] Remove new.target check in Intl functions and method (Closed)
Patch Set: rebase Created 4 years 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/js/i18n.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/intl/not-constructors.js
diff --git a/test/intl/not-constructors.js b/test/intl/not-constructors.js
new file mode 100644
index 0000000000000000000000000000000000000000..d21ae868e083d5e46dfeaf7c9652981b2fb0ce98
--- /dev/null
+++ b/test/intl/not-constructors.js
@@ -0,0 +1,34 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertThrows(() => new Intl.getCanonicalLocales('en'), TypeError);
+
+let collator = new Intl.Collator('en');
+assertThrows(() => new collator.resolvedOptions(), TypeError);
+
+assertThrows(() => new Intl.Collator.supportedLocalesOf('en'), TypeError);
+
+let numberformat = new Intl.NumberFormat('en');
+assertThrows(() => new numberformat.resolvedOptions(), TypeError);
+
+assertThrows(() => new Intl.NumberFormat.supportedLocalesOf('en'), TypeError);
+
+let datetimeformat = new Intl.DateTimeFormat('en');
+assertThrows(() => new datetimeformat.resolvedOptions(), TypeError);
+assertThrows(() => new datetimeformat.formatToParts(new Date()), TypeError);
+
+assertThrows(() => new Intl.DateTimeFormat.supportedLocalesOf('en'), TypeError);
+
+assertThrows(() => new "".localCompare(""), TypeError);
+
+assertThrows(() => new "".normalize(), TypeError);
+assertThrows(() => new "".toLocaleLowerCase(), TypeError);
+assertThrows(() => new "".toLocaleUpperCase(), TypeError);
+assertThrows(() => new "".toLowerCase(), TypeError);
+assertThrows(() => new "".toUpperCase(), TypeError);
+
+assertThrows(() => new 3..toLocaleString(), TypeError);
+assertThrows(() => new (new Date()).toLocaleString(), TypeError);
+assertThrows(() => new (new Date()).toLocaleDateString(), TypeError);
+assertThrows(() => new (new Date()).toLocaleTimeString(), TypeError);
« no previous file with comments | « src/js/i18n.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698