diff options
Diffstat (limited to 'cli/tests/unit/rename_test.ts')
-rw-r--r-- | cli/tests/unit/rename_test.ts | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/cli/tests/unit/rename_test.ts b/cli/tests/unit/rename_test.ts index 711b63aa7..c5df8e4a4 100644 --- a/cli/tests/unit/rename_test.ts +++ b/cli/tests/unit/rename_test.ts @@ -7,7 +7,7 @@ import { unitTest, } from "./test_util.ts"; -function assertMissing(path: string): void { +function assertMissing(path: string) { let caughtErr = false; let info; try { @@ -20,12 +20,12 @@ function assertMissing(path: string): void { assertEquals(info, undefined); } -function assertFile(path: string): void { +function assertFile(path: string) { const info = Deno.lstatSync(path); assert(info.isFile); } -function assertDirectory(path: string, mode?: number): void { +function assertDirectory(path: string, mode?: number) { const info = Deno.lstatSync(path); assert(info.isDirectory); if (Deno.build.os !== "windows" && mode !== undefined) { @@ -35,7 +35,7 @@ function assertDirectory(path: string, mode?: number): void { unitTest( { perms: { read: true, write: true } }, - function renameSyncSuccess(): void { + function renameSyncSuccess() { const testDir = Deno.makeTempDirSync(); const oldpath = testDir + "/oldpath"; const newpath = testDir + "/newpath"; @@ -48,7 +48,7 @@ unitTest( unitTest( { perms: { read: true, write: true } }, - function renameSyncWithURL(): void { + function renameSyncWithURL() { const testDir = Deno.makeTempDirSync(); const oldpath = testDir + "/oldpath"; const newpath = testDir + "/newpath"; @@ -64,7 +64,7 @@ unitTest( unitTest( { perms: { read: false, write: true } }, - function renameSyncReadPerm(): void { + function renameSyncReadPerm() { assertThrows(() => { const oldpath = "/oldbaddir"; const newpath = "/newbaddir"; @@ -75,7 +75,7 @@ unitTest( unitTest( { perms: { read: true, write: false } }, - function renameSyncWritePerm(): void { + function renameSyncWritePerm() { assertThrows(() => { const oldpath = "/oldbaddir"; const newpath = "/newbaddir"; @@ -86,7 +86,7 @@ unitTest( unitTest( { perms: { read: true, write: true } }, - async function renameSuccess(): Promise<void> { + async function renameSuccess() { const testDir = Deno.makeTempDirSync(); const oldpath = testDir + "/oldpath"; const newpath = testDir + "/newpath"; @@ -99,7 +99,7 @@ unitTest( unitTest( { perms: { read: true, write: true } }, - async function renameWithURL(): Promise<void> { + async function renameWithURL() { const testDir = Deno.makeTempDirSync(); const oldpath = testDir + "/oldpath"; const newpath = testDir + "/newpath"; @@ -119,7 +119,7 @@ function readFileString(filename: string): string { return dec.decode(dataRead); } -function writeFileString(filename: string, s: string): void { +function writeFileString(filename: string, s: string) { const enc = new TextEncoder(); const data = enc.encode(s); Deno.writeFileSync(filename, data, { mode: 0o666 }); @@ -127,7 +127,7 @@ function writeFileString(filename: string, s: string): void { unitTest( { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, - function renameSyncErrorsUnix(): void { + function renameSyncErrorsUnix() { const testDir = Deno.makeTempDirSync(); const oldfile = testDir + "/oldfile"; const olddir = testDir + "/olddir"; @@ -141,21 +141,21 @@ unitTest( writeFileString(file, "world"); assertThrows( - (): void => { + () => { Deno.renameSync(oldfile, emptydir); }, Error, "Is a directory", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, fulldir); }, Error, "Directory not empty", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, file); }, Error, @@ -170,21 +170,21 @@ unitTest( Deno.symlinkSync(testDir + "/nonexistent", danglingLink); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, fileLink); }, Error, "Not a directory", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, dirLink); }, Error, "Not a directory", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, danglingLink); }, Error, @@ -202,7 +202,7 @@ unitTest( unitTest( { ignore: Deno.build.os !== "windows", perms: { read: true, write: true } }, - function renameSyncErrorsWin(): void { + function renameSyncErrorsWin() { const testDir = Deno.makeTempDirSync(); const oldfile = testDir + "/oldfile"; const olddir = testDir + "/olddir"; @@ -216,21 +216,21 @@ unitTest( writeFileString(file, "world"); assertThrows( - (): void => { + () => { Deno.renameSync(oldfile, emptydir); }, Deno.errors.PermissionDenied, "Access is denied", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, fulldir); }, Deno.errors.PermissionDenied, "Access is denied", ); assertThrows( - (): void => { + () => { Deno.renameSync(olddir, emptydir); }, Deno.errors.PermissionDenied, |