mirror of
https://github.com/denoland/deno
synced 2024-08-27 20:09:17 +00:00
Improve new TextDecoder().toString() (#2032)
This commit is contained in:
parent
ada5ffa610
commit
659acadf77
|
@ -442,6 +442,9 @@ export class TextDecoder {
|
|||
|
||||
return codePointsToString(output);
|
||||
}
|
||||
get [Symbol.toStringTag]() {
|
||||
return "TextDecoder";
|
||||
}
|
||||
}
|
||||
|
||||
export class TextEncoder {
|
||||
|
@ -467,4 +470,7 @@ export class TextEncoder {
|
|||
|
||||
return new Uint8Array(output);
|
||||
}
|
||||
get [Symbol.toStringTag]() {
|
||||
return "TextEncoder";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,3 +91,11 @@ test(function textDecoderSharedInt32Array() {
|
|||
const actual = decoder.decode(i32);
|
||||
assertEquals(actual, "ABCDEFGH");
|
||||
});
|
||||
|
||||
test(function toStringShouldBeWebCompatibility() {
|
||||
const encoder = new TextEncoder();
|
||||
assertEquals(encoder.toString(), "[object TextEncoder]");
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
assertEquals(decoder.toString(), "[object TextDecoder]");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue