-
Notifications
You must be signed in to change notification settings - Fork 9
Core Spec Test Coverage
Asumu Takikawa edited this page Oct 3, 2024
·
29 revisions
-
Explicitly not tested
- Source map being an invalid JSON document (depending on the implementation, this may only test the test harness itself, rather than any interesting properties about the tool)
-
Encoding
- Base64 VLQ
- VLQs should decode correctly
- A VLQ with a non-base64 character will fail to decode. (test)
- A VLQ with one digit and no continuation digits should decode. (test)
- A negative VLQ with the sign bit set to 1 should decode. (test)
- A VLQ with non-zero continuation bits (and more than one digit) should decode. (test)
- A VLQ with a non-zero continuation bit with no further digits should fail to decode. (test)
- A VLQ should decode with the correct order of digits (least to most significant).
- A long VLQ with many trailing zero digits will decode. (test)
- A VLQ exceeding the 32-bit size limit is invalid. (test)
- A VLQ at exactly the 32-bit size limit should be decoded (positive and negative). (test)
- VLQs should decode correctly
- Base64 VLQ
-
Basic format
-
version
field -
file
field- Optional, allow missing (many tests)
- Must be a string (test)
-
sourceRoot
field- Optional, allow missing (many tests)
- Must be a string (test)
-
sources
field -
sourcesContent
field- Optional, may be missing
- Must be an array
- Array elements must be
null
or a string
-
names
field -
mappings
field -
ignoreList
field: see below under "Ignore List" - Extra unrecognized fields are allowed (test)
-
-
Index maps
-
Mappings format
- Each line is separated by ";"
- A line may consist of zero segments (e.g., ";;")
- Each line consists only of segments separated by ","
- Must have greater than zero fields (note: many implementations don't check)
- Must have 1, 4, or 5 fields
- The source index must not be out of bounds of the sources array
- The name index must not be out of bounds of the names array
- Absolute VLQ values must be non-negative
- The column must be non-negative
- The source index must be non-negative
- The original line must be non-negative
- The original column must be non-negative
- The name index must be non-negative
- Relative VLQ values must be non-negative after adding to previous value
- The column must be non-negative
- The source index must be non-negative
- The original line must be non-negative
- The original column must be non-negative
- The name index must be non-negative
-
Ignore list
- An ignore list is optional, may be missing
- An ignore list can't be a non-array value
- An ignore list can be empty
- An ignore list entry must be a non-negative integer
- An ignore list entry cannot be out-of-bounds of the sources array
- Ignore list entries are detected and are present
- Items not specified in the ignore list don't show up as ignored
-
Mappings semantics
- A source map with no mappings does not map any position.
- A single field segment gets mapped to the correct line and column.
- A four field segment gets mapped to the correct line and column.
- A five field segment gets mapped to the correct line and column.
- When a name is present in a segment, it is correctly mapped.
- When a source is present in a segment, it is correctly mapped.
- The second occurrence of a field segment in a line is mapped relative to the previous one.
- When a new line starts, the generated column field resets to zero rather than being relative to the previous line.
- For fields other than the generated column, a segment field that has occurred once in a previous line is mapped relatively when it occurs in the next line.
- Ensure that a transitive source map mapping works as expected
- Index maps are correctly used in mappings
- An index map with one sub-map will map correctly.
- An index map with multiple sub-maps will map correctly, with appropriate offsets for the second and later sub-maps.
-
Resolution of sources
- When
sourceRoot
is provided, it is prepended to anysources
entries and will be mapped with the full URL. - If the source URL is an absolute URL, it is resolved as an absolute URL.
- If the source URL is a relative URL, it is resolved relative to the source map path.
- When
-
Wasm support
- Create versions of the tests that use a Wasm source.
- Basic format validation
-
originalScopes
may be omitted (Q: mustoriginalScopes
andgeneratedRanges
both be absent or present simultaneously?) -
generatedRanges
may be omitted -
originalScopes
must be an array (of strings)- The length of
originalScopes
should be less than or equal to the length ofsources
- Can entries be null?
- The length of
-
generatedRanges
must be a string
-