diff options
author | dubiousjim <dubiousjim@gmail.com> | 2020-03-20 16:03:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-20 16:03:04 -0400 |
commit | 77a44163fb22139a8269eb216014640aaf7a7fa8 (patch) | |
tree | 30d7973a4bfbfb36fab385b039ef60574178af2c /cli/js/tests/chmod_test.ts | |
parent | b22f48970fc18c4e5fd72df15ac798477fbe49cb (diff) |
chmod should throw on Windows (#4446)
Diffstat (limited to 'cli/js/tests/chmod_test.ts')
-rw-r--r-- | cli/js/tests/chmod_test.ts | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/cli/js/tests/chmod_test.ts b/cli/js/tests/chmod_test.ts index 4720fa784..e71e0bf26 100644 --- a/cli/js/tests/chmod_test.ts +++ b/cli/js/tests/chmod_test.ts @@ -1,10 +1,8 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { unitTest, assert, assertEquals } from "./test_util.ts"; -const isNotWindows = Deno.build.os !== "win"; - unitTest( - { perms: { read: true, write: true } }, + { ignore: Deno.build.os === "win", perms: { read: true, write: true } }, function chmodSyncSuccess(): void { const enc = new TextEncoder(); const data = enc.encode("Hello"); @@ -12,15 +10,11 @@ unitTest( const filename = tempDir + "/test.txt"; Deno.writeFileSync(filename, data, { mode: 0o666 }); - // On windows no effect, but should not crash Deno.chmodSync(filename, 0o777); - // Check success when not on windows - if (isNotWindows) { - const fileInfo = Deno.statSync(filename); - assert(fileInfo.mode); - assertEquals(fileInfo.mode & 0o777, 0o777); - } + const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); + assertEquals(fileInfo.mode & 0o777, 0o777); } ); @@ -79,7 +73,7 @@ unitTest({ perms: { write: false } }, function chmodSyncPerm(): void { }); unitTest( - { perms: { read: true, write: true } }, + { ignore: Deno.build.os === "win", perms: { read: true, write: true } }, async function chmodSuccess(): Promise<void> { const enc = new TextEncoder(); const data = enc.encode("Hello"); @@ -87,15 +81,11 @@ unitTest( const filename = tempDir + "/test.txt"; Deno.writeFileSync(filename, data, { mode: 0o666 }); - // On windows no effect, but should not crash await Deno.chmod(filename, 0o777); - // Check success when not on windows - if (isNotWindows) { - const fileInfo = Deno.statSync(filename); - assert(fileInfo.mode); - assertEquals(fileInfo.mode & 0o777, 0o777); - } + const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); + assertEquals(fileInfo.mode & 0o777, 0o777); } ); |