-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporal: Add tests for PlainTime#{toJSON/toString}.
- Loading branch information
Showing
4 changed files
with
34 additions
and
14 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
test/built-ins/Temporal/PlainTime/prototype/toJSON/basic.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// 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.tojson | ||
description: Basic behavior for toJSON | ||
features: [Temporal] | ||
---*/ | ||
|
||
const tests = [ | ||
[new Temporal.PlainTime(5, 3, 1), "05:03:01"], | ||
[new Temporal.PlainTime(15, 23), "15:23:00"], | ||
[new Temporal.PlainTime(15, 23, 30), "15:23:30"], | ||
[new Temporal.PlainTime(15, 23, 30, 123, 400), "15:23:30.1234"], | ||
]; | ||
|
||
const options = new Proxy({}, { | ||
get() { throw new Test262Error("should not get properties off argument") } | ||
}); | ||
for (const [time, expected] of tests) { | ||
assert.sameValue(time.toJSON(), expected, "toJSON without argument"); | ||
assert.sameValue(time.toJSON(options), expected, "toJSON with argument"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters