1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

use prebuilt "not implemented" error (#4442)

This commit is contained in:
dubiousjim 2020-03-20 12:10:02 -04:00 committed by GitHub
parent 69303e2149
commit 1c6f177d19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 17 deletions

View file

@ -83,7 +83,7 @@ unitTest(
{ perms: { write: true, read: true } }, { perms: { write: true, read: true } },
function removeSyncDanglingSymlinkSuccess(): void { function removeSyncDanglingSymlinkSuccess(): void {
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink"; 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; let errOnWindows;
try { try {
Deno.symlinkSync("unexistent_file", danglingSymlinkPath); Deno.symlinkSync("unexistent_file", danglingSymlinkPath);
@ -91,7 +91,7 @@ unitTest(
errOnWindows = err; errOnWindows = err;
} }
if (Deno.build.os === "win") { if (Deno.build.os === "win") {
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const pathInfo = Deno.lstatSync(danglingSymlinkPath); const pathInfo = Deno.lstatSync(danglingSymlinkPath);
assert(pathInfo.isSymlink()); assert(pathInfo.isSymlink());
@ -116,7 +116,7 @@ unitTest(
const filePath = tempDir + "/test.txt"; const filePath = tempDir + "/test.txt";
const validSymlinkPath = tempDir + "/valid_symlink"; const validSymlinkPath = tempDir + "/valid_symlink";
Deno.writeFileSync(filePath, data, { mode: 0o666 }); 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; let errOnWindows;
try { try {
Deno.symlinkSync(filePath, validSymlinkPath); Deno.symlinkSync(filePath, validSymlinkPath);
@ -124,7 +124,7 @@ unitTest(
errOnWindows = err; errOnWindows = err;
} }
if (Deno.build.os === "win") { if (Deno.build.os === "win") {
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const symlinkPathInfo = Deno.statSync(validSymlinkPath); const symlinkPathInfo = Deno.statSync(validSymlinkPath);
assert(symlinkPathInfo.isFile()); assert(symlinkPathInfo.isFile());
@ -319,7 +319,7 @@ unitTest(
{ perms: { write: true, read: true } }, { perms: { write: true, read: true } },
async function removeDanglingSymlinkSuccess(): Promise<void> { async function removeDanglingSymlinkSuccess(): Promise<void> {
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink"; 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; let errOnWindows;
try { try {
Deno.symlinkSync("unexistent_file", danglingSymlinkPath); Deno.symlinkSync("unexistent_file", danglingSymlinkPath);
@ -327,7 +327,7 @@ unitTest(
errOnWindows = e; errOnWindows = e;
} }
if (Deno.build.os === "win") { if (Deno.build.os === "win") {
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const pathInfo = Deno.lstatSync(danglingSymlinkPath); const pathInfo = Deno.lstatSync(danglingSymlinkPath);
assert(pathInfo.isSymlink()); assert(pathInfo.isSymlink());
@ -352,7 +352,7 @@ unitTest(
const filePath = tempDir + "/test.txt"; const filePath = tempDir + "/test.txt";
const validSymlinkPath = tempDir + "/valid_symlink"; const validSymlinkPath = tempDir + "/valid_symlink";
Deno.writeFileSync(filePath, data, { mode: 0o666 }); 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; let errOnWindows;
try { try {
Deno.symlinkSync(filePath, validSymlinkPath); Deno.symlinkSync(filePath, validSymlinkPath);
@ -360,7 +360,7 @@ unitTest(
errOnWindows = e; errOnWindows = e;
} }
if (Deno.build.os === "win") { if (Deno.build.os === "win") {
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const symlinkPathInfo = Deno.statSync(validSymlinkPath); const symlinkPathInfo = Deno.statSync(validSymlinkPath);
assert(symlinkPathInfo.isFile()); assert(symlinkPathInfo.isFile());

View file

@ -17,7 +17,7 @@ unitTest(
} }
if (errOnWindows) { if (errOnWindows) {
assertEquals(Deno.build.os, "win"); assertEquals(Deno.build.os, "win");
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const newNameInfoLStat = Deno.lstatSync(newname); const newNameInfoLStat = Deno.lstatSync(newname);
const newNameInfoStat = Deno.statSync(newname); const newNameInfoStat = Deno.statSync(newname);
@ -54,7 +54,8 @@ unitTest(
} }
if (err) { if (err) {
assertEquals(Deno.build.os, "win"); 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; errOnWindows = e;
} }
if (errOnWindows) { if (errOnWindows) {
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "not implemented");
} else { } else {
const newNameInfoLStat = Deno.lstatSync(newname); const newNameInfoLStat = Deno.lstatSync(newname);
const newNameInfoStat = Deno.statSync(newname); const newNameInfoStat = Deno.statSync(newname);

View file

@ -53,7 +53,7 @@ export function createResolvable<T>(): Resolvable<T> {
// @internal // @internal
export function notImplemented(): never { export function notImplemented(): never {
throw new Error("Not implemented"); throw new Error("not implemented");
} }
// @internal // @internal

View file

@ -730,7 +730,7 @@ fn op_symlink(
// Unlike with chmod/chown, here we don't // Unlike with chmod/chown, here we don't
// require `oldpath` to exist on Windows // require `oldpath` to exist on Windows
let _ = oldpath; // avoid unused warning let _ = oldpath; // avoid unused warning
return Err(OpError::other("Not implemented".to_string())); return Err(OpError::not_implemented());
} }
}) })
} }

View file

@ -56,7 +56,7 @@ Deno.test(async function ensureSymlinkIfItExist(): Promise<void> {
await assertThrowsAsync( await assertThrowsAsync(
(): Promise<void> => ensureSymlink(testFile, linkFile), (): Promise<void> => ensureSymlink(testFile, linkFile),
Error, Error,
"Not implemented" "not implemented"
); );
await Deno.remove(testDir, { recursive: true }); await Deno.remove(testDir, { recursive: true });
return; return;
@ -85,7 +85,7 @@ Deno.test(function ensureSymlinkSyncIfItExist(): void {
assertThrows( assertThrows(
(): void => ensureSymlinkSync(testFile, linkFile), (): void => ensureSymlinkSync(testFile, linkFile),
Error, Error,
"Not implemented" "not implemented"
); );
Deno.removeSync(testDir, { recursive: true }); Deno.removeSync(testDir, { recursive: true });
return; return;
@ -115,7 +115,7 @@ Deno.test(async function ensureSymlinkDirectoryIfItExist(): Promise<void> {
await assertThrowsAsync( await assertThrowsAsync(
(): Promise<void> => ensureSymlink(testDir, linkDir), (): Promise<void> => ensureSymlink(testDir, linkDir),
Error, Error,
"Not implemented" "not implemented"
); );
await Deno.remove(testDir, { recursive: true }); await Deno.remove(testDir, { recursive: true });
return; return;
@ -147,7 +147,7 @@ Deno.test(function ensureSymlinkSyncDirectoryIfItExist(): void {
assertThrows( assertThrows(
(): void => ensureSymlinkSync(testDir, linkDir), (): void => ensureSymlinkSync(testDir, linkDir),
Error, Error,
"Not implemented" "not implemented"
); );
Deno.removeSync(testDir, { recursive: true }); Deno.removeSync(testDir, { recursive: true });
return; return;