Debian Codegraph @

js/src/tests/non262/Intl/RelativeTimeFormat/construct-newtarget.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
2
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 var obj = new Intl.RelativeTimeFormat();
8
9 // Test that new RTF produces an object with the right prototype.
10 assertEq(Object.getPrototypeOf(obj), Intl.RelativeTimeFormat.prototype);
11
12 // Test subclassing %Intl.RelativeTimeFormat% works correctly.
13 class MyRelativeTimeFormat extends Intl.RelativeTimeFormat {}
14
15 var obj = new MyRelativeTimeFormat();
16 assertEq(obj instanceof MyRelativeTimeFormat, true);
17 assertEq(obj instanceof Intl.RelativeTimeFormat, true);
18 assertEq(Object.getPrototypeOf(obj), MyRelativeTimeFormat.prototype);
19
20 if (typeof reportCompare === "function")
21 reportCompare(0, 0);