diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/files_test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index a509672c0..d15f1f538 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -791,3 +791,19 @@ Deno.test( assertEquals(res, "hello world!"); }, ); + +Deno.test( + { permissions: { read: true, write: true } }, + async function readTextFileNonUtf8() { + const path = await Deno.makeTempFile(); + const file = await Deno.open(path, { write: true }); + await file.write(new TextEncoder().encode("hello ")); + await file.write(new Uint8Array([0xC0])); + file.close(); + + const res = await Deno.readTextFile(path); + const resSync = Deno.readTextFileSync(path); + assertEquals(res, resSync); + assertEquals(res, "hello \uFFFD"); + }, +); |