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

Side by Side Diff: test/intl/bad-target.js

Issue 2623683002: [intl] Remove redundant type checking system (Closed)
Patch Set: Created 3 years, 11 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 | « src/runtime/runtime-i18n.cc ('k') | test/mjsunit/regress/regress-4962.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 2016 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 // Calling Intl methods with a bad receiver throws a TypeError
6
7 // An uninitialized object of the same type
8 assertThrows(() => Object.create(Intl.DateTimeFormat.prototype).format(),
9 TypeError);
10 assertThrows(() => Object.create(Intl.NumberFormat.prototype).format(),
11 TypeError);
12 assertThrows(() => Object.create(Intl.Collator.prototype).compare(),
13 TypeError);
14 assertThrows(() => Object.create(Intl.v8BreakIterator.prototype).adoptText(),
15 TypeError);
16 assertThrows(() => Object.create(Intl.v8BreakIterator.prototype).first(),
17 TypeError);
18 assertThrows(() => Object.create(Intl.v8BreakIterator.prototype).next(),
19 TypeError);
20 assertThrows(() => Object.create(Intl.v8BreakIterator.prototype).current(),
21 TypeError);
22 assertThrows(() => Object.create(Intl.v8BreakIterator.prototype).breakType(),
23 TypeError);
24
25 // Or similarly, just accessing the method getter on the prototype
26 assertThrows(() => Intl.DateTimeFormat.prototype.format, TypeError);
27 assertThrows(() => Intl.NumberFormat.prototype.format, TypeError);
28 assertThrows(() => Intl.Collator.prototype.compare, TypeError);
29 assertThrows(() => Intl.v8BreakIterator.prototype.adoptText, TypeError);
30 assertThrows(() => Intl.v8BreakIterator.prototype.first, TypeError);
31 assertThrows(() => Intl.v8BreakIterator.prototype.next, TypeError);
32 assertThrows(() => Intl.v8BreakIterator.prototype.current, TypeError);
33 assertThrows(() => Intl.v8BreakIterator.prototype.breakType, TypeError);
34
35 // The method .call'd on a different instance will have that
36 // other instance benignly ignored, since it's a bound function
37 let nf = Intl.NumberFormat();
38 let df = Intl.DateTimeFormat();
39 assertEquals("0", nf.format.call(df, 0));
OLDNEW
« no previous file with comments | « src/runtime/runtime-i18n.cc ('k') | test/mjsunit/regress/regress-4962.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698