My working unpac space for OCaml projects in development
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Temporal] Test use of toLocaleString with hourCycle

Add tests that toLocaleString uses the hourCycle parameter properly
when formatting the string. Test PlainDateTime, PlainTime, Instant, and
ZonedDateTime.

authored by

Tim Chevalier and committed by
Ms2ger
9aa1fa11 7d177749

+128
+32
vendor/git/test262/test/intl402/Temporal/Instant/prototype/toLocaleString/hourcycle.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.instant.prototype.tolocalestring 6 + description: Hour cycle should be correctly set when defaults are used 7 + features: [Temporal] 8 + ---*/ 9 + 10 + const output0 = "00:00:00"; 11 + const output11 = "0:00:00"; 12 + const output12 = "12:00:00"; 13 + const output24 = "24:00:00"; 14 + 15 + const item = new Temporal.Instant(0n); 16 + var result = item.toLocaleString("en", { hour12: false, timeZone: "UTC" }); 17 + assert.sameValue(result.includes(output0), true, `output for hour12: false should include ${output0}`); 18 + 19 + result = item.toLocaleString("en", { hour12: true, timeZone: "UTC" }); 20 + assert.sameValue(result.includes(output12), true, `output for hour12: true should include ${output12}`); 21 + 22 + result = item.toLocaleString("en", { hourCycle: "h23", timeZone: "UTC" }); 23 + assert.sameValue(result.includes(output0), true, `output for hourCycle: h23 should include ${output0}`); 24 + 25 + result = item.toLocaleString("en", { hourCycle: "h24", timeZone: "UTC" }); 26 + assert.sameValue(result.includes(output24), true, `output for hourCycle: h24 should include ${output24}`); 27 + 28 + result = item.toLocaleString("en", { hourCycle: "h11", timeZone: "UTC" }); 29 + assert.sameValue(result.includes(output11), true, `output for hourCycle: h11 should include ${output11}`); 30 + 31 + result = item.toLocaleString("en", { hourCycle: "h12", timeZone: "UTC" }); 32 + assert.sameValue(result.includes(output12), true, `output for hourCycle: h12 should include ${output12}`);
+32
vendor/git/test262/test/intl402/Temporal/PlainDateTime/prototype/toLocaleString/hourcycle.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plaindatetime.prototype.tolocalestring 6 + description: Hour cycle should be correctly set when defaults are used 7 + features: [Temporal] 8 + ---*/ 9 + 10 + const output0 = "00:00:00"; 11 + const output11 = "0:00:00"; 12 + const output12 = "12:00:00"; 13 + const output24 = "24:00:00"; 14 + 15 + const item = new Temporal.PlainDateTime(2000, 5, 2, 0, 0, 0, 0, 0, 0); 16 + var result = item.toLocaleString("en", { hour12: false, timeZone: "UTC" }); 17 + assert.sameValue(result.includes(output0), true, `output for hour12: false should include ${output0}`); 18 + 19 + result = item.toLocaleString("en", { hour12: true, timeZone: "UTC" }); 20 + assert.sameValue(result.includes(output12), true, `output for hour12: true should include ${output12}`); 21 + 22 + result = item.toLocaleString("en", { hourCycle: "h23", timeZone: "UTC" }); 23 + assert.sameValue(result.includes(output0), true, `output for hourCycle: h23 should include ${output0}`); 24 + 25 + result = item.toLocaleString("en", { hourCycle: "h24", timeZone: "UTC" }); 26 + assert.sameValue(result.includes(output24), true, `output for hourCycle: h24 should include ${output24}`); 27 + 28 + result = item.toLocaleString("en", { hourCycle: "h11", timeZone: "UTC" }); 29 + assert.sameValue(result.includes(output11), true, `output for hourCycle: h11 should include ${output11}`); 30 + 31 + result = item.toLocaleString("en", { hourCycle: "h12", timeZone: "UTC" }); 32 + assert.sameValue(result.includes(output12), true, `output for hourCycle: h12 should include ${output12}`);
+32
vendor/git/test262/test/intl402/Temporal/PlainTime/prototype/toLocaleString/hourcycle.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.plaintime.prototype.tolocalestring 6 + description: Hour cycle should be correctly set when defaults are used 7 + features: [Temporal] 8 + ---*/ 9 + 10 + const output0 = "00:00:00"; 11 + const output11 = "0:00:00"; 12 + const output12 = "12:00:00"; 13 + const output24 = "24:00:00"; 14 + 15 + const item = new Temporal.PlainTime(0, 0); 16 + var result = item.toLocaleString("en", { hour12: false, timeZone: "UTC" }); 17 + assert.sameValue(result.includes(output0), true, `output for hour12: false should include ${output0}`); 18 + 19 + result = item.toLocaleString("en", { hour12: true, timeZone: "UTC" }); 20 + assert.sameValue(result.includes(output12), true, `output for hour12: true should include ${output12}`); 21 + 22 + result = item.toLocaleString("en", { hourCycle: "h23", timeZone: "UTC" }); 23 + assert.sameValue(result.includes(output0), true, `output for hourCycle: h23 should include ${output0}`); 24 + 25 + result = item.toLocaleString("en", { hourCycle: "h24", timeZone: "UTC" }); 26 + assert.sameValue(result.includes(output24), true, `output for hourCycle: h24 should include ${output24}`); 27 + 28 + result = item.toLocaleString("en", { hourCycle: "h11", timeZone: "UTC" }); 29 + assert.sameValue(result.includes(output11), true, `output for hourCycle: h11 should include ${output11}`); 30 + 31 + result = item.toLocaleString("en", { hourCycle: "h12", timeZone: "UTC" }); 32 + assert.sameValue(result.includes(output12), true, `output for hourCycle: h12 should include ${output12}`);
+32
vendor/git/test262/test/intl402/Temporal/ZonedDateTime/prototype/toLocaleString/hourcycle.js
··· 1 + // Copyright (C) 2025 Igalia, S.L. All rights reserved. 2 + // This code is governed by the BSD license found in the LICENSE file. 3 + 4 + /*--- 5 + esid: sec-temporal.zoneddatetime.prototype.tolocalestring 6 + description: Hour cycle should be correctly set when defaults are used 7 + features: [Temporal] 8 + ---*/ 9 + 10 + const output0 = "00:00:00"; 11 + const output11 = "0:00:00"; 12 + const output12 = "12:00:00"; 13 + const output24 = "24:00:00"; 14 + 15 + const item = new Temporal.ZonedDateTime(0n, "UTC"); 16 + var result = item.toLocaleString("en", { hour12: false }); 17 + assert.sameValue(result.includes(output0), true, `output for hour12: false should include ${output0}`); 18 + 19 + result = item.toLocaleString("en", { hour12: true }); 20 + assert.sameValue(result.includes(output12), true, `output for hour12: true should include ${output12}`); 21 + 22 + result = item.toLocaleString("en", { hourCycle: "h23" }); 23 + assert.sameValue(result.includes(output0), true, `output for hourCycle: h23 should include ${output0}`); 24 + 25 + result = item.toLocaleString("en", { hourCycle: "h24" }); 26 + assert.sameValue(result.includes(output24), true, `output for hourCycle: h24 should include ${output24}`); 27 + 28 + result = item.toLocaleString("en", { hourCycle: "h11" }); 29 + assert.sameValue(result.includes(output11), true, `output for hourCycle: h11 should include ${output11}`); 30 + 31 + result = item.toLocaleString("en", { hourCycle: "h12" }); 32 + assert.sameValue(result.includes(output12), true, `output for hourCycle: h12 should include ${output12}`);