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

symlink: Ignore type parameter on non-Windows platforms (#2185)

Fixes #2169
This commit is contained in:
Yingbo (Max) Wang 2019-04-23 06:47:29 -07:00 committed by Ryan Dahl
parent d940801754
commit da64fba046
2 changed files with 8 additions and 3 deletions

View file

@ -3,14 +3,14 @@ import * as msg from "gen/cli/msg_generated";
import * as flatbuffers from "./flatbuffers"; import * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch"; import * as dispatch from "./dispatch";
import * as util from "./util"; import * as util from "./util";
import { platform } from "./build";
function req( function req(
oldname: string, oldname: string,
newname: string, newname: string,
type?: string type?: string
): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { ): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
// TODO Use type for Windows. if (platform.os === "win" && type) {
if (type) {
return util.notImplemented(); return util.notImplemented();
} }
const builder = flatbuffers.createBuilder(); const builder = flatbuffers.createBuilder();

View file

@ -14,6 +14,7 @@ testPerm({ read: true, write: true }, function symlinkSyncSuccess(): void {
errOnWindows = e; errOnWindows = e;
} }
if (errOnWindows) { if (errOnWindows) {
assertEquals(Deno.platform.os, "win");
assertEquals(errOnWindows.kind, Deno.ErrorKind.Other); assertEquals(errOnWindows.kind, Deno.ErrorKind.Other);
assertEquals(errOnWindows.message, "Not implemented"); assertEquals(errOnWindows.message, "Not implemented");
} else { } else {
@ -36,6 +37,7 @@ test(function symlinkSyncPerm(): void {
}); });
// Just for now, until we implement symlink for Windows. // Just for now, until we implement symlink for Windows.
// Symlink with type should succeed on other platforms with type ignored
testPerm({ write: true }, function symlinkSyncNotImplemented(): void { testPerm({ write: true }, function symlinkSyncNotImplemented(): void {
let err; let err;
try { try {
@ -43,7 +45,10 @@ testPerm({ write: true }, function symlinkSyncNotImplemented(): void {
} catch (e) { } catch (e) {
err = e; err = e;
} }
assertEquals(err.message, "Not implemented"); if (err) {
assertEquals(Deno.platform.os, "win");
assertEquals(err.message, "Not implemented");
}
}); });
testPerm({ read: true, write: true }, async function symlinkSuccess(): Promise< testPerm({ read: true, write: true }, async function symlinkSuccess(): Promise<