summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordubiousjim <dubiousjim@gmail.com>2020-03-20 12:10:02 -0400
committerGitHub <noreply@github.com>2020-03-20 12:10:02 -0400
commit1c6f177d198cb4abe7a126dc543b733fa95376d1 (patch)
tree23e6310e1b07111b7f986529e73be9da609f88b3
parent69303e21495a14a2c6709f96af364682a485ac21 (diff)
use prebuilt "not implemented" error (#4442)
-rw-r--r--cli/js/tests/remove_test.ts16
-rw-r--r--cli/js/tests/symlink_test.ts7
-rw-r--r--cli/js/util.ts2
-rw-r--r--cli/ops/fs.rs2
-rw-r--r--std/fs/ensure_symlink_test.ts8
5 files changed, 18 insertions, 17 deletions
diff --git a/cli/js/tests/remove_test.ts b/cli/js/tests/remove_test.ts
index fac5ba303..209558de7 100644
--- a/cli/js/tests/remove_test.ts
+++ b/cli/js/tests/remove_test.ts
@@ -83,7 +83,7 @@ unitTest(
{ perms: { write: true, read: true } },
function removeSyncDanglingSymlinkSuccess(): void {
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink";
- // TODO(#3832): Remove "Not Implemented" error checking when symlink creation is implemented for Windows
+ // TODO(#3832): Remove "not Implemented" error checking when symlink creation is implemented for Windows
let errOnWindows;
try {
Deno.symlinkSync("unexistent_file", danglingSymlinkPath);
@@ -91,7 +91,7 @@ unitTest(
errOnWindows = err;
}
if (Deno.build.os === "win") {
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const pathInfo = Deno.lstatSync(danglingSymlinkPath);
assert(pathInfo.isSymlink());
@@ -116,7 +116,7 @@ unitTest(
const filePath = tempDir + "/test.txt";
const validSymlinkPath = tempDir + "/valid_symlink";
Deno.writeFileSync(filePath, data, { mode: 0o666 });
- // TODO(#3832): Remove "Not Implemented" error checking when symlink creation is implemented for Windows
+ // TODO(#3832): Remove "not Implemented" error checking when symlink creation is implemented for Windows
let errOnWindows;
try {
Deno.symlinkSync(filePath, validSymlinkPath);
@@ -124,7 +124,7 @@ unitTest(
errOnWindows = err;
}
if (Deno.build.os === "win") {
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const symlinkPathInfo = Deno.statSync(validSymlinkPath);
assert(symlinkPathInfo.isFile());
@@ -319,7 +319,7 @@ unitTest(
{ perms: { write: true, read: true } },
async function removeDanglingSymlinkSuccess(): Promise<void> {
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink";
- // TODO(#3832): Remove "Not Implemented" error checking when symlink creation is implemented for Windows
+ // TODO(#3832): Remove "not Implemented" error checking when symlink creation is implemented for Windows
let errOnWindows;
try {
Deno.symlinkSync("unexistent_file", danglingSymlinkPath);
@@ -327,7 +327,7 @@ unitTest(
errOnWindows = e;
}
if (Deno.build.os === "win") {
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const pathInfo = Deno.lstatSync(danglingSymlinkPath);
assert(pathInfo.isSymlink());
@@ -352,7 +352,7 @@ unitTest(
const filePath = tempDir + "/test.txt";
const validSymlinkPath = tempDir + "/valid_symlink";
Deno.writeFileSync(filePath, data, { mode: 0o666 });
- // TODO(#3832): Remove "Not Implemented" error checking when symlink creation is implemented for Windows
+ // TODO(#3832): Remove "not Implemented" error checking when symlink creation is implemented for Windows
let errOnWindows;
try {
Deno.symlinkSync(filePath, validSymlinkPath);
@@ -360,7 +360,7 @@ unitTest(
errOnWindows = e;
}
if (Deno.build.os === "win") {
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const symlinkPathInfo = Deno.statSync(validSymlinkPath);
assert(symlinkPathInfo.isFile());
diff --git a/cli/js/tests/symlink_test.ts b/cli/js/tests/symlink_test.ts
index 221960bb0..25533fc64 100644
--- a/cli/js/tests/symlink_test.ts
+++ b/cli/js/tests/symlink_test.ts
@@ -17,7 +17,7 @@ unitTest(
}
if (errOnWindows) {
assertEquals(Deno.build.os, "win");
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const newNameInfoLStat = Deno.lstatSync(newname);
const newNameInfoStat = Deno.statSync(newname);
@@ -54,7 +54,8 @@ unitTest(
}
if (err) {
assertEquals(Deno.build.os, "win");
- assertEquals(err.message, "Not implemented");
+ // from cli/js/util.ts:notImplemented
+ assertEquals(err.message, "not implemented");
}
}
);
@@ -74,7 +75,7 @@ unitTest(
errOnWindows = e;
}
if (errOnWindows) {
- assertEquals(errOnWindows.message, "Not implemented");
+ assertEquals(errOnWindows.message, "not implemented");
} else {
const newNameInfoLStat = Deno.lstatSync(newname);
const newNameInfoStat = Deno.statSync(newname);
diff --git a/cli/js/util.ts b/cli/js/util.ts
index ec39d6f35..692ea6d00 100644
--- a/cli/js/util.ts
+++ b/cli/js/util.ts
@@ -53,7 +53,7 @@ export function createResolvable<T>(): Resolvable<T> {
// @internal
export function notImplemented(): never {
- throw new Error("Not implemented");
+ throw new Error("not implemented");
}
// @internal
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs
index 31b22b3e6..416ae210a 100644
--- a/cli/ops/fs.rs
+++ b/cli/ops/fs.rs
@@ -730,7 +730,7 @@ fn op_symlink(
// Unlike with chmod/chown, here we don't
// require `oldpath` to exist on Windows
let _ = oldpath; // avoid unused warning
- return Err(OpError::other("Not implemented".to_string()));
+ return Err(OpError::not_implemented());
}
})
}
diff --git a/std/fs/ensure_symlink_test.ts b/std/fs/ensure_symlink_test.ts
index 2357650ab..f0dc4fbe4 100644
--- a/std/fs/ensure_symlink_test.ts
+++ b/std/fs/ensure_symlink_test.ts
@@ -56,7 +56,7 @@ Deno.test(async function ensureSymlinkIfItExist(): Promise<void> {
await assertThrowsAsync(
(): Promise<void> => ensureSymlink(testFile, linkFile),
Error,
- "Not implemented"
+ "not implemented"
);
await Deno.remove(testDir, { recursive: true });
return;
@@ -85,7 +85,7 @@ Deno.test(function ensureSymlinkSyncIfItExist(): void {
assertThrows(
(): void => ensureSymlinkSync(testFile, linkFile),
Error,
- "Not implemented"
+ "not implemented"
);
Deno.removeSync(testDir, { recursive: true });
return;
@@ -115,7 +115,7 @@ Deno.test(async function ensureSymlinkDirectoryIfItExist(): Promise<void> {
await assertThrowsAsync(
(): Promise<void> => ensureSymlink(testDir, linkDir),
Error,
- "Not implemented"
+ "not implemented"
);
await Deno.remove(testDir, { recursive: true });
return;
@@ -147,7 +147,7 @@ Deno.test(function ensureSymlinkSyncDirectoryIfItExist(): void {
assertThrows(
(): void => ensureSymlinkSync(testDir, linkDir),
Error,
- "Not implemented"
+ "not implemented"
);
Deno.removeSync(testDir, { recursive: true });
return;