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 dispatch from "./dispatch";
import * as util from "./util";
import { platform } from "./build";
function req(
oldname: string,
newname: string,
type?: string
): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
// TODO Use type for Windows.
if (type) {
if (platform.os === "win" && type) {
return util.notImplemented();
}
const builder = flatbuffers.createBuilder();

View file

@ -14,6 +14,7 @@ testPerm({ read: true, write: true }, function symlinkSyncSuccess(): void {
errOnWindows = e;
}
if (errOnWindows) {
assertEquals(Deno.platform.os, "win");
assertEquals(errOnWindows.kind, Deno.ErrorKind.Other);
assertEquals(errOnWindows.message, "Not implemented");
} else {
@ -36,6 +37,7 @@ test(function symlinkSyncPerm(): void {
});
// 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 {
let err;
try {
@ -43,7 +45,10 @@ testPerm({ write: true }, function symlinkSyncNotImplemented(): void {
} catch (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<