mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Temporal: Extend tests for getISOFields. (#3560)
This commit is contained in:
parent
98b76ef533
commit
6f2e6872fb
18
test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js
vendored
Normal file
18
test/built-ins/Temporal/PlainDate/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2, calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
||||
assert.sameValue(result.calendar, calendar, "calendar result");
|
12
test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/PlainDate/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
24
test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js
vendored
Normal file
24
test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
||||
assert.sameValue(result.isoHour, 12, "isoHour result");
|
||||
assert.sameValue(result.isoMinute, 34, "isoMinute result");
|
||||
assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
||||
assert.sameValue(result.calendar, calendar, "calendar result");
|
12
test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/PlainDateTime/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
18
test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js
vendored
Normal file
18
test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.PlainMonthDay(5, 2, calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoYear, 1972, "isoYear result");
|
||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
||||
assert.sameValue(result.isoDay, 2, "isoDay result");
|
||||
assert.sameValue(result.calendar, calendar, "calendar result");
|
12
test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/PlainMonthDay/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainmonthday.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainMonthDay(5, 2);
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
21
test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js
vendored
Normal file
21
test/built-ins/Temporal/PlainTime/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321, calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoHour, 12, "isoHour result");
|
||||
assert.sameValue(result.isoMinute, 34, "isoMinute result");
|
||||
assert.sameValue(result.isoSecond, 56, "isoSecond result");
|
||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
||||
assert.sameValue(result.calendar.id, "iso8601", "calendar result");
|
12
test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/PlainTime/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
18
test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js
vendored
Normal file
18
test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5, calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoYear, 2000, "isoYear result");
|
||||
assert.sameValue(result.isoMonth, 5, "isoMonth result");
|
||||
assert.sameValue(result.isoDay, 1, "isoDay result");
|
||||
assert.sameValue(result.calendar, calendar, "calendar result");
|
12
test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/PlainYearMonth/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plainyearmonth.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainYearMonth(2000, 5);
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
26
test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js
vendored
Normal file
26
test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/custom.js
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
||||
description: getISOFields does not call into user code.
|
||||
includes: [temporalHelpers.js]
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const calendar = TemporalHelpers.calendarThrowEverything();
|
||||
const instance = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC", calendar);
|
||||
const result = instance.getISOFields();
|
||||
|
||||
assert.sameValue(result.isoYear, 2001, "isoYear result");
|
||||
assert.sameValue(result.isoMonth, 9, "isoMonth result");
|
||||
assert.sameValue(result.isoDay, 10, "isoDay result");
|
||||
assert.sameValue(result.isoHour, 1, "isoHour result");
|
||||
assert.sameValue(result.isoMinute, 46, "isoMinute result");
|
||||
assert.sameValue(result.isoSecond, 40, "isoSecond result");
|
||||
assert.sameValue(result.isoMillisecond, 987, "isoMillisecond result");
|
||||
assert.sameValue(result.isoMicrosecond, 654, "isoMicrosecond result");
|
||||
assert.sameValue(result.isoNanosecond, 321, "isoNanosecond result");
|
||||
assert.sameValue(result.offset, "+00:00", "offset result");
|
||||
assert.sameValue(result.calendar, calendar, "calendar result");
|
||||
assert.sameValue(result.timeZone.id, "UTC", "timeZone result");
|
12
test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js
vendored
Normal file
12
test/built-ins/Temporal/ZonedDateTime/prototype/getISOFields/prototype.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.getisofields
|
||||
description: Correct prototype on the object returned from getISOFields
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(1_000_086_400_987_654_321n, "UTC");
|
||||
const result = instance.getISOFields();
|
||||
assert.sameValue(Object.getPrototypeOf(result), Object.prototype, "prototype");
|
Loading…
x
Reference in New Issue
Block a user