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

Side by Side Diff: test/intl/general/constructor.js

Issue 1828543007: Add new semantics + compat fallback to Intl constructor Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests; make more minimal Created 4 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 unified diff | Download patch
« no previous file with comments | « test/intl/assert.js ('k') | test/mjsunit/regress/regress-4870.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 let compatConstructors = [
6 {c: Intl.DateTimeFormat, m: "format"},
7 {c: Intl.NumberFormat, m: "format"},
8 ];
9
10 for (let {c, m} of compatConstructors) {
11 let i = Object.create(c.prototype);
12 assertTrue(i instanceof c);
13 assertThrows(() => i[m], TypeError);
14 assertEquals(i, c.call(i));
15 assertEquals(i[m], i[m]);
16 assertTrue(i instanceof c);
17
18 for ({c: c2, m: m2} of compatConstructors) {
19 if (c2 === c) {
20 assertThrows(() => c2.call(i), TypeError);
21 } else {
22 let i2 = c2.call(i);
23 assertTrue(i2 != i);
24 assertFalse(i2 instanceof c);
25 assertTrue(i2 instanceof c2);
26 assertEquals(i2[m2], i2[m2]);
27 }
28 }
29 }
30
31 let noCompatConstructors = [
32 {c: Intl.Collator, m: "compare"},
33 {c: Intl.v8BreakIterator, m: "next"},
34 ];
35
36 for (let {c, m} of noCompatConstructors) {
37 let i = Object.create(c.prototype);
38 assertTrue(i instanceof c);
39 assertThrows(() => i[m], TypeError);
40 let i2 = c.call(i);
41 assertTrue(i2 != i);
42 assertEquals('function', typeof i2[m]);
43 assertTrue(i2 instanceof c);
44 }
OLDNEW
« no previous file with comments | « test/intl/assert.js ('k') | test/mjsunit/regress/regress-4870.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698