From da64fba046e4f324bff62d71ae74906fa6e3421f Mon Sep 17 00:00:00 2001 From: "Yingbo (Max) Wang" Date: Tue, 23 Apr 2019 06:47:29 -0700 Subject: symlink: Ignore type parameter on non-Windows platforms (#2185) Fixes #2169 --- js/symlink.ts | 4 ++-- js/symlink_test.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/symlink.ts b/js/symlink.ts index 9230e9fa0..28bf6c859 100644 --- a/js/symlink.ts +++ b/js/symlink.ts @@ -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(); diff --git a/js/symlink_test.ts b/js/symlink_test.ts index ae9b0c8cc..2ce666949 100644 --- a/js/symlink_test.ts +++ b/js/symlink_test.ts @@ -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< -- cgit v1.2.3