mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
test invalid negative durations objects
This commit is contained in:
parent
f6179a6eb6
commit
392f0049d7
22
test/intl402/DurationFormat/prototype/format/invalid-negative-duration-throws.js
vendored
Normal file
22
test/intl402/DurationFormat/prototype/format/invalid-negative-duration-throws.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// 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" });
|
20
test/intl402/DurationFormat/prototype/formatToParts/invalid-negative-duration-throws.js
vendored
Normal file
20
test/intl402/DurationFormat/prototype/formatToParts/invalid-negative-duration-throws.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.formatToParts
|
||||
description: formatToParts basic tests for invalid negative duration objects that should throw RangeError exception.
|
||||
features: [Intl.DurationFormat]
|
||||
---*/
|
||||
|
||||
const df = new Intl.DurationFormat();
|
||||
|
||||
assert.throws(RangeError, () => { df.formatToParts({
|
||||
hours : -1,
|
||||
minutes: 10
|
||||
}), "Throws when mixing negative and positive values" });
|
||||
|
||||
assert.throws(RangeError, () => { df.formatToParts({
|
||||
hours : 2,
|
||||
minutes: -10
|
||||
}), "Throws when mixing negative and positive values" });
|
Loading…
x
Reference in New Issue
Block a user