diff options
Diffstat (limited to 'js/os_test.ts')
-rw-r--r-- | js/os_test.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/js/os_test.ts b/js/os_test.ts index df88b5085..4c5da1505 100644 --- a/js/os_test.ts +++ b/js/os_test.ts @@ -85,35 +85,6 @@ test(async function lstatSyncNotFound() { assertEqual(badInfo, undefined); }); -testPerm({ write: true }, function writeFileSyncSuccess() { - const enc = new TextEncoder(); - const data = enc.encode("Hello"); - const filename = deno.makeTempDirSync() + "/test.txt"; - deno.writeFileSync(filename, data, 0o666); - const dataRead = deno.readFileSync(filename); - const dec = new TextDecoder("utf-8"); - const actual = dec.decode(dataRead); - assertEqual("Hello", actual); -}); - -// For this test to pass we need --allow-write permission. -// Otherwise it will fail with deno.PermissionDenied instead of deno.NotFound. -testPerm({ write: true }, function writeFileSyncFail() { - const enc = new TextEncoder(); - const data = enc.encode("Hello"); - const filename = "/baddir/test.txt"; - // The following should fail because /baddir doesn't exist (hopefully). - let caughtError = false; - try { - deno.writeFileSync(filename, data); - } catch (e) { - caughtError = true; - assertEqual(e.kind, deno.ErrorKind.NotFound); - assertEqual(e.name, "NotFound"); - } - assert(caughtError); -}); - testPerm({ write: true }, function makeTempDirSync() { const dir1 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" }); const dir2 = deno.makeTempDirSync({ prefix: "hello", suffix: "world" }); |