1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 00:21:05 -05:00

Reenable copyFile tests

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2018-10-03 15:11:38 -07:00 committed by Bert Belder
parent 47508c7207
commit 3c080ca39a
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -31,7 +31,6 @@ testPerm({ write: true }, function copyFileSyncSuccess() {
assertSameContent(fromFilename, toFilename); assertSameContent(fromFilename, toFilename);
}); });
/* Test is incorrect. TODO: fix this test.
testPerm({ write: true }, function copyFileSyncFailure() { testPerm({ write: true }, function copyFileSyncFailure() {
const tempDir = deno.makeTempDirSync(); const tempDir = deno.makeTempDirSync();
const fromFilename = tempDir + "/from.txt"; const fromFilename = tempDir + "/from.txt";
@ -44,11 +43,16 @@ testPerm({ write: true }, function copyFileSyncFailure() {
err = e; err = e;
} }
assert(!!err); assert(!!err);
// Rust deem non-existent path as invalid input if (deno.platform.os === "win") {
assertEqual(err.kind, deno.ErrorKind.InvalidInput); assertEqual(err.kind, deno.ErrorKind.NotFound);
assertEqual(err.name, "InvalidInput"); assertEqual(err.name, "NotFound");
} else {
// On *nix, Rust deem non-existent path as invalid input
// See https://github.com/rust-lang/rust/issues/54800
assertEqual(err.kind, deno.ErrorKind.InvalidInput);
assertEqual(err.name, "InvalidInput");
}
}); });
*/
testPerm({ write: true }, function copyFileSyncOverwrite() { testPerm({ write: true }, function copyFileSyncOverwrite() {
const tempDir = deno.makeTempDirSync(); const tempDir = deno.makeTempDirSync();
@ -88,7 +92,6 @@ testPerm({ write: true }, async function copyFileSuccess() {
assertSameContent(fromFilename, toFilename); assertSameContent(fromFilename, toFilename);
}); });
/* Test is incorrect. TODO: fix this test.
testPerm({ write: true }, async function copyFileFailure() { testPerm({ write: true }, async function copyFileFailure() {
const tempDir = deno.makeTempDirSync(); const tempDir = deno.makeTempDirSync();
const fromFilename = tempDir + "/from.txt"; const fromFilename = tempDir + "/from.txt";
@ -101,11 +104,16 @@ testPerm({ write: true }, async function copyFileFailure() {
err = e; err = e;
} }
assert(!!err); assert(!!err);
// Rust deem non-existent path as invalid input if (deno.platform.os === "win") {
assertEqual(err.kind, deno.ErrorKind.InvalidInput); assertEqual(err.kind, deno.ErrorKind.NotFound);
assertEqual(err.name, "InvalidInput"); assertEqual(err.name, "NotFound");
} else {
// On *nix, Rust deem non-existent path as invalid input
// See https://github.com/rust-lang/rust/issues/54800
assertEqual(err.kind, deno.ErrorKind.InvalidInput);
assertEqual(err.name, "InvalidInput");
}
}); });
*/
testPerm({ write: true }, async function copyFileOverwrite() { testPerm({ write: true }, async function copyFileOverwrite() {
const tempDir = deno.makeTempDirSync(); const tempDir = deno.makeTempDirSync();