diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js')
-rw-r--r-- | js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js b/js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js new file mode 100644 index 0000000000..6e44e1974f --- /dev/null +++ b/js/src/tests/test262/staging/Intl402/Temporal/old/addition-across-lunisolar-leap-months.js @@ -0,0 +1,96 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2018 Bloomberg LP. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal-intl +description: Addition across lunisolar leap months +features: [Temporal] +---*/ + +// Adding years across Hebrew leap month +var date = Temporal.PlainDate.from({ + year: 5783, + monthCode: "M08", + day: 2, + calendar: "hebrew" +}); +var added = date.add({ years: 1 }); +assert.sameValue(added.monthCode, date.monthCode); +assert.sameValue(added.year, date.year + 1); + +// Adding months across Hebrew leap month +var date = Temporal.PlainDate.from({ + year: 5783, + monthCode: "M08", + day: 2, + calendar: "hebrew" +}); +var added = date.add({ months: 13 }); +assert.sameValue(added.monthCode, date.monthCode); +assert.sameValue(added.year, date.year + 1); + +// Adding months and years across Hebrew leap month +var date = Temporal.PlainDate.from({ + year: 5783, + monthCode: "M08", + day: 2, + calendar: "hebrew" +}); +var added = date.add({ + years: 1, + months: 12 +}); +assert.sameValue(added.monthCode, date.monthCode); +assert.sameValue(added.year, date.year + 2); +var testChineseData = new Date("2001-02-01T00:00Z").toLocaleString("en-US-u-ca-chinese", { + day: "numeric", + month: "numeric", + year: "numeric", + era: "short", + timeZone: "UTC" +}); +var hasOutdatedChineseIcuData = !testChineseData.endsWith("2001"); + +// Adding years across Chinese leap month" +if(hasOutdatedChineseIcuData) { + var date = Temporal.PlainDate.from({ + year: 2000, + monthCode: "M08", + day: 2, + calendar: "chinese" + }); + var added = date.add({ years: 1 }); + assert.sameValue(added.monthCode, date.monthCode); + assert.sameValue(added.year, date.year + 1); +} +// Adding months across Chinese leap month +if(hasOutdatedChineseIcuData) { + var date = Temporal.PlainDate.from({ + year: 2000, + monthCode: "M08", + day: 2, + calendar: "chinese" + }); + var added = date.add({ months: 13 }); + assert.sameValue(added.monthCode, date.monthCode); + assert.sameValue(added.year, date.year + 1); +} + +// Adding months and years across Chinese leap month +if(hasOutdatedChineseIcuData) { + var date = Temporal.PlainDate.from({ + year: 2001, + monthCode: "M08", + day: 2, + calendar: "chinese" + }); + var added = date.add({ + years: 1, + months: 12 + }); + assert.sameValue(added.monthCode, date.monthCode); + assert.sameValue(added.year, date.year + 2); +}; + +reportCompare(0, 0); |