Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a788f19

Browse files
committed
more tests for TextDecoder
1 parent 5d85f73 commit a788f19

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎src/utils/utf8.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function utf8DecodeJs(bytes: Uint8Array, inputOffset: number, byteLength:
134134

135135
const sharedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder() : null;
136136
export const TEXT_DECODER_AVAILABLE = process.env.TEXT_DECODER !== "never" && !!sharedTextDecoder;
137-
export const TEXT_DECODER_THRESHOLD = 200;
137+
export const TEXT_DECODER_THRESHOLD = process.env.TEXT_DECODER!=="force" ? 200 : 0;
138138

139139
export function utf8DecodeTD(bytes: Uint8Array, inputOffset: number, byteLength: number): string {
140140
const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength);

‎test/msgpack-test-suite.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ describe("msgpack-test-suite", () => {
8989
FLOAT64_NEGATIVE_INF: Number.NEGATIVE_INFINITY,
9090
FLOAT64_NAN: Number.NaN,
9191
STR16: "a".repeat(0x100),
92+
STR16_MBS: "🌏".repeat(0x100),
9293
STR32: "b".repeat(0x10_000),
94+
STR32_MBS: "🍣".repeat(0x10_000),
9395
STR32LARGE: "c".repeat(0x100_000), // may cause "RangeError: Maximum call stack size exceeded" in simple implelementions
9496
STR_INCLUDING_NUL: "foo0円bar",
9597
STR_BROKEN_FF: "\xff",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /