-
Notifications
You must be signed in to change notification settings - Fork 514
Open
Description
Proposal README
Proposal rendered spec
For testing the tests, the proposal is shipped in v8.
- Tests for new function
JSON.isRawJSON:- Boilerplate:
- Function length.
- Function name.
- Property descriptor.
- Function is not a constructor.
- Can be invoked as a function with success cases:
- An instance created by a call to
JSON.rawJSON. - Some objects without an
[[IsRawJSON]]internal slot:{},[]. - Some non-Objects:
null,undefinded, a Boolean, a symbol, a number.
- An instance created by a call to
- Boilerplate:
- Tests for new function
JSON.rawJSON:- Boilerplate:
- Function length.
- Function name.
- Function is not a constructor.
- Property descriptor.
- Can be invoked as a function
- Success cases
- Number, negative number, string,
true,false,null - Returned object has the correct shape (null prototype,
rawJSONown property) - Returned object is frozen
json-parse-with-source: Sync with stage 4 PR and complete testing plan #4682
- Number, negative number, string,
- Failure cases, throwing:
-
SyntaxErrorin case of:- The empty string.
- A string starting or ending with a tab, a linefeed, a carriage return, or a space.
- A non-Array object literal:
{}. - An Array literal:
[1].
-
TypeErrorwhen trying to extend a rawJSON result object.
json-parse-with-source: Sync with stage 4 PR and complete testing plan #4682
-
- Success cases
- Boilerplate:
- Tests for the new abstract operations in the algorithm of
JSON.parse, each test should have a callablereviverargument:- For paths in
CreateJSONParseRecord, only success cases (normal output), a test for each branch:- an Array literal
- an Object literal
- an Object literal with a repeated key
- NullLiteral, BooleanLiteral, NumericLiteral, StringLiteral, ArrayLiteral, ObjectLiteral, UnaryExpression
- a combination of all the above success cases nested
- For paths in
InternalizeJSONProperty, and the interaction withJSON.stringify, test with areviverthat modifies the holder object, as mentioned in tc39 issue 39:
json-parse-with-source: Sync with stage 4 PR and complete testing plan #4682- [array and plain object] overwrite of not-yet-processed entry should result in absence of source for that entry
- primitive to non-primitive
- non-primitive to primitive
- non-primitive to a clone (same data but different identity)
- primitive to a different primitive
- [array and plain object] overwrite and restoration of not-yet-processed entry should preserve source for that entry
- primitive
- non-primitive
- [array] splicing out an item should result in absence of source from the affected index forward
- ...but restoring items at their original index should preserve source
- [array and plain object] overwrite of not-yet-processed entry should result in absence of source for that entry
- For paths in
- Test the overall intended functionality with examples from the proposal README and slides (linked in README).
- Test that reviver function is applied to the source, not the parsed value, by roundtripping:
-
JSON.parse(" 9999999999999999", (key, val) => BigInt(val)) // → 9999999999999999n - other?
-
- Test that reviver function is applied to the source, not the parsed value, by roundtripping:
Metadata
Metadata
Assignees
Labels
No labels