1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

re-enable symlink tests on windows (#5746)

This commit is contained in:
Ali Hasani 2020-05-22 22:07:25 +04:30 committed by GitHub
parent 960f9ccb2e
commit 1a6c541327
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,18 +1,20 @@
const { test } = Deno;
import { readlink, readlinkSync } from "./_fs_readlink.ts";
import { assertEquals, assert } from "../../testing/asserts.ts";
import * as path from "../path.ts";
const testDir = Deno.makeTempDirSync();
const oldname = testDir + "/oldname";
const newname = testDir + "/newname";
const oldname = path.join(testDir, "oldname");
const newname = path.join(testDir, "newname");
if (Deno.build.os !== "windows") {
if (Deno.build.os === "windows") {
Deno.symlinkSync(oldname, newname, { type: "file" });
} else {
Deno.symlinkSync(oldname, newname);
}
test({
name: "readlinkSuccess",
ignore: Deno.build.os === "windows",
async fn() {
const data = await new Promise((res, rej) => {
readlink(newname, (err, data) => {
@ -30,7 +32,6 @@ test({
test({
name: "readlinkEncodeBufferSuccess",
ignore: Deno.build.os === "windows",
async fn() {
const data = await new Promise((res, rej) => {
readlink(newname, { encoding: "buffer" }, (err, data) => {
@ -48,7 +49,6 @@ test({
test({
name: "readlinkSyncSuccess",
ignore: Deno.build.os === "windows",
fn() {
const data = readlinkSync(newname);
assertEquals(typeof data, "string");
@ -58,7 +58,6 @@ test({
test({
name: "readlinkEncodeBufferSuccess",
ignore: Deno.build.os === "windows",
fn() {
const data = readlinkSync(newname, { encoding: "buffer" });
assert(data instanceof Uint8Array);