Skip to content

Commit

Permalink
symlink: Ignore type parameter on non-Windows platforms (denoland#2185)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwyb authored and ry committed Apr 23, 2019
1 parent d940801 commit da64fba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/symlink.ts
Expand Up @@ -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();
Expand Down
7 changes: 6 additions & 1 deletion js/symlink_test.ts
Expand Up @@ -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 {
Expand All @@ -36,14 +37,18 @@ 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 {
Deno.symlinkSync("oldname", "newname", "dir");
} 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<
Expand Down

0 comments on commit da64fba

Please sign in to comment.