summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DurationFormat/prototype/format/invalid-negative-duration-throws.js
blob: b349ee52f7a46beeb7c408a538760f59269511d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// |reftest| skip -- Intl.DurationFormat is not supported
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-Intl.DurationFormat.prototype.format
description: format basic tests for invalid negative duration objects that should throw RangeError exception.
features: [Intl.DurationFormat]
---*/



const df = new Intl.DurationFormat();

assert.throws(RangeError, () => { df.format({
  hours : -1,
  minutes: 10
}), "Throws when mixing negative and positive values" });

assert.throws(RangeError, () => { df.format({
  hours : 2,
  minutes: -10
}), "Throws when mixing negative and positive values" });

reportCompare(0, 0);