Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
test: update WPT encoding tests
PR-URL: #43958 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
- Loading branch information
1 parent
51cb0d4
commit 198cf59d2c4ea157a202bc9e9d34a394b19c610d
Showing
15 changed files
with
259 additions
and
22 deletions.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cross-Origin-Opener-Policy: same-origin | ||
| Cross-Origin-Embedder-Policy: require-corp |
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,2 @@ | ||
| // META: script=/resources/idlharness-shadowrealm.js | ||
| idl_test_shadowrealm(["encoding"], ["streams"]); |
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,14 @@ | ||
| <!DOCTYPE html> | ||
| <script src="/resources/testharness.js"></script> | ||
| <script src="/resources/testharnessreport.js"></script> | ||
| <script> | ||
|
|
||
| test(() => { | ||
| const decoder = new TextDecoder('utf-8'); | ||
| const buffer = new SharedArrayBuffer(4); | ||
| assert_throws_js(TypeError, () => { | ||
| decoder.decode(new Uint8Array(buffer)); | ||
| }, 'constructing TextDecoder with SharedArrayBuffer view should throw'); | ||
| }, 'decoding SharedArrayBuffer'); | ||
|
|
||
| </script> |
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,2 @@ | ||
| Cross-Origin-Opener-Policy:same-origin | ||
| Cross-Origin-Embedder-Policy:require-corp |
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cross-Origin-Opener-Policy: same-origin | ||
| Cross-Origin-Embedder-Policy: require-corp |
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,2 @@ | ||
| Cross-Origin-Opener-Policy: same-origin | ||
| Cross-Origin-Embedder-Policy: require-corp |
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,40 @@ | ||
| test(() => { | ||
| // Truncated sequences | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0])), "\uFFFD"); | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x9F])), "\uFFFD"); | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x9F, 0x92])), "\uFFFD"); | ||
|
|
||
| // Errors near end-of-queue | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x9F, 0x41])), "\uFFFDA"); | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x41, 0x42])), "\uFFFDAB"); | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x41, 0xF0])), "\uFFFDA\uFFFD"); | ||
| assert_equals(new TextDecoder().decode(new Uint8Array([0xF0, 0x8F, 0x92])), "\uFFFD\uFFFD\uFFFD"); | ||
| }, "TextDecoder end-of-queue handling"); | ||
|
|
||
| test(() => { | ||
| const decoder = new TextDecoder(); | ||
| decoder.decode(new Uint8Array([0xF0]), { stream: true }); | ||
| assert_equals(decoder.decode(), "\uFFFD"); | ||
|
|
||
| decoder.decode(new Uint8Array([0xF0]), { stream: true }); | ||
| decoder.decode(new Uint8Array([0x9F]), { stream: true }); | ||
| assert_equals(decoder.decode(), "\uFFFD"); | ||
|
|
||
| decoder.decode(new Uint8Array([0xF0, 0x9F]), { stream: true }); | ||
| assert_equals(decoder.decode(new Uint8Array([0x92])), "\uFFFD"); | ||
|
|
||
| assert_equals(decoder.decode(new Uint8Array([0xF0, 0x9F]), { stream: true }), ""); | ||
| assert_equals(decoder.decode(new Uint8Array([0x41]), { stream: true }), "\uFFFDA"); | ||
| assert_equals(decoder.decode(), ""); | ||
|
|
||
| assert_equals(decoder.decode(new Uint8Array([0xF0, 0x41, 0x42]), { stream: true }), "\uFFFDAB"); | ||
| assert_equals(decoder.decode(), ""); | ||
|
|
||
| assert_equals(decoder.decode(new Uint8Array([0xF0, 0x41, 0xF0]), { stream: true }), "\uFFFDA"); | ||
| assert_equals(decoder.decode(), "\uFFFD"); | ||
|
|
||
| assert_equals(decoder.decode(new Uint8Array([0xF0]), { stream: true }), ""); | ||
| assert_equals(decoder.decode(new Uint8Array([0x8F]), { stream: true }), "\uFFFD\uFFFD"); | ||
| assert_equals(decoder.decode(new Uint8Array([0x92]), { stream: true }), "\uFFFD"); | ||
| assert_equals(decoder.decode(), ""); | ||
| }, "TextDecoder end-of-queue handling using stream: true"); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Cross-Origin-Opener-Policy: same-origin | ||
| Cross-Origin-Embedder-Policy: require-corp |
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