diff options
Diffstat (limited to 'cli/js/chmod_test.ts')
-rw-r--r-- | cli/js/chmod_test.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/js/chmod_test.ts b/cli/js/chmod_test.ts index 3ecb4256a..b3b0a2ae2 100644 --- a/cli/js/chmod_test.ts +++ b/cli/js/chmod_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { testPerm, assertEquals } from "./test_util.ts"; +import { testPerm, assert, assertEquals } from "./test_util.ts"; const isNotWindows = Deno.build.os !== "win"; @@ -16,6 +16,7 @@ testPerm({ read: true, write: true }, function chmodSyncSuccess(): void { // Check success when not on windows if (isNotWindows) { const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); } }); @@ -35,14 +36,17 @@ if (isNotWindows) { Deno.symlinkSync(filename, symlinkName); let symlinkInfo = Deno.lstatSync(symlinkName); + assert(symlinkInfo.mode); const symlinkMode = symlinkInfo.mode & 0o777; // platform dependent Deno.chmodSync(symlinkName, 0o777); // Change actual file mode, not symlink const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); symlinkInfo = Deno.lstatSync(symlinkName); + assert(symlinkInfo.mode); assertEquals(symlinkInfo.mode & 0o777, symlinkMode); } ); @@ -86,6 +90,7 @@ testPerm({ read: true, write: true }, async function chmodSuccess(): Promise< // Check success when not on windows if (isNotWindows) { const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); } }); @@ -105,14 +110,17 @@ if (isNotWindows) { Deno.symlinkSync(filename, symlinkName); let symlinkInfo = Deno.lstatSync(symlinkName); + assert(symlinkInfo.mode); const symlinkMode = symlinkInfo.mode & 0o777; // platform dependent await Deno.chmod(symlinkName, 0o777); // Just change actual file mode, not symlink const fileInfo = Deno.statSync(filename); + assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); symlinkInfo = Deno.lstatSync(symlinkName); + assert(symlinkInfo.mode); assertEquals(symlinkInfo.mode & 0o777, symlinkMode); } ); |