Debian Codegraph @

js/src/tests/test262/intl402/DurationFormat/newtarget-undefined.js

raw
1 // |reftest| skip-if(!Intl.hasOwnProperty('DurationFormat')) -- Intl.DurationFormat is not enabled unconditionally
2 // Copyright 2022 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-Intl.DurationFormat
7 description: >
8 Verifies the NewTarget check for Intl.DurationFormat.
9 info: |
10 Intl.DurationFormat ([ locales [ , options ]])
11 (...)
12 1. If NewTarget is undefined, throw a TypeError exception.
13 features: [Intl.DurationFormat]
14 ---*/
15
16 assert.sameValue(typeof Intl.DurationFormat, "function");
17
18 assert.throws(TypeError, function() {
19 Intl.DurationFormat();
20 });
21
22 assert.throws(TypeError, function() {
23 Intl.DurationFormat("en");
24 });
25
26 assert.throws(TypeError, function() {
27 Intl.DurationFormat("not-valid-tag");
28 });
29
30 reportCompare(0, 0);