From 77a44163fb22139a8269eb216014640aaf7a7fa8 Mon Sep 17 00:00:00 2001 From: dubiousjim Date: Fri, 20 Mar 2020 16:03:04 -0400 Subject: chmod should throw on Windows (#4446) --- cli/js/tests/chmod_test.ts | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'cli/js/tests') 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 { 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); } ); -- cgit v1.2.3