mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 20:59:10 +00:00
test(cli): align unit test permissions with runtime test permissions (#12189)
This commit is contained in:
parent
87e78802b0
commit
830586d242
45 changed files with 664 additions and 574 deletions
|
@ -35,7 +35,7 @@ unitTest(async function arrayBufferFromByteArrays() {
|
||||||
|
|
||||||
//FormData
|
//FormData
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function bodyMultipartFormData() {
|
async function bodyMultipartFormData() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/multipart_form_data.txt",
|
"http://localhost:4545/multipart_form_data.txt",
|
||||||
|
@ -54,7 +54,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function bodyURLEncodedFormData() {
|
async function bodyURLEncodedFormData() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/subdir/form_urlencoded.txt",
|
"http://localhost:4545/subdir/form_urlencoded.txt",
|
||||||
|
@ -73,7 +73,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: {} }, async function bodyURLSearchParams() {
|
unitTest({ permissions: {} }, async function bodyURLSearchParams() {
|
||||||
const body = buildBody(new URLSearchParams({ hello: "world" }));
|
const body = buildBody(new URLSearchParams({ hello: "world" }));
|
||||||
|
|
||||||
const text = await body.text();
|
const text = await body.text();
|
||||||
|
|
|
@ -8,7 +8,10 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function chmodSyncSuccess() {
|
function chmodSyncSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -25,7 +28,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function chmodSyncUrl() {
|
function chmodSyncUrl() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -47,7 +53,7 @@ unitTest(
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
ignore: Deno.build.os === "windows",
|
ignore: Deno.build.os === "windows",
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
function chmodSyncSymlinkSuccess() {
|
function chmodSyncSymlinkSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
@ -75,21 +81,24 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function chmodSyncFailure() {
|
unitTest({ permissions: { write: true } }, function chmodSyncFailure() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
const filename = "/badfile.txt";
|
const filename = "/badfile.txt";
|
||||||
Deno.chmodSync(filename, 0o777);
|
Deno.chmodSync(filename, 0o777);
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, function chmodSyncPerm() {
|
unitTest({ permissions: { write: false } }, function chmodSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.chmodSync("/somefile.txt", 0o777);
|
Deno.chmodSync("/somefile.txt", 0o777);
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function chmodSuccess() {
|
async function chmodSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -106,7 +115,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function chmodUrl() {
|
async function chmodUrl() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -129,7 +141,7 @@ unitTest(
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
ignore: Deno.build.os === "windows",
|
ignore: Deno.build.os === "windows",
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
async function chmodSymlinkSuccess() {
|
async function chmodSymlinkSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
@ -157,14 +169,14 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, async function chmodFailure() {
|
unitTest({ permissions: { write: true } }, async function chmodFailure() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
const filename = "/badfile.txt";
|
const filename = "/badfile.txt";
|
||||||
await Deno.chmod(filename, 0o777);
|
await Deno.chmod(filename, 0o777);
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, async function chmodPerm() {
|
unitTest({ permissions: { write: false } }, async function chmodPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.chmod("/somefile.txt", 0o777);
|
await Deno.chmod("/somefile.txt", 0o777);
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
|
|
|
@ -40,7 +40,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownSyncFileNotExist() {
|
async function chownSyncFileNotExist() {
|
||||||
const { uid, gid } = await getUidAndGid();
|
const { uid, gid } = await getUidAndGid();
|
||||||
const filePath = Deno.makeTempDirSync() + "/chown_test_file.txt";
|
const filePath = Deno.makeTempDirSync() + "/chown_test_file.txt";
|
||||||
|
@ -52,7 +55,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownFileNotExist() {
|
async function chownFileNotExist() {
|
||||||
const { uid, gid } = await getUidAndGid();
|
const { uid, gid } = await getUidAndGid();
|
||||||
const filePath = (await Deno.makeTempDir()) + "/chown_test_file.txt";
|
const filePath = (await Deno.makeTempDir()) + "/chown_test_file.txt";
|
||||||
|
@ -64,7 +70,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true }, ignore: Deno.build.os == "windows" },
|
{ permissions: { write: true }, ignore: Deno.build.os == "windows" },
|
||||||
function chownSyncPermissionDenied() {
|
function chownSyncPermissionDenied() {
|
||||||
const dirPath = Deno.makeTempDirSync();
|
const dirPath = Deno.makeTempDirSync();
|
||||||
const filePath = dirPath + "/chown_test_file.txt";
|
const filePath = dirPath + "/chown_test_file.txt";
|
||||||
|
@ -79,7 +85,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true }, ignore: Deno.build.os == "windows" },
|
{ permissions: { write: true }, ignore: Deno.build.os == "windows" },
|
||||||
async function chownPermissionDenied() {
|
async function chownPermissionDenied() {
|
||||||
const dirPath = await Deno.makeTempDir();
|
const dirPath = await Deno.makeTempDir();
|
||||||
const filePath = dirPath + "/chown_test_file.txt";
|
const filePath = dirPath + "/chown_test_file.txt";
|
||||||
|
@ -94,7 +100,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownSyncSucceed() {
|
async function chownSyncSucceed() {
|
||||||
// TODO(bartlomieju): when a file's owner is actually being changed,
|
// TODO(bartlomieju): when a file's owner is actually being changed,
|
||||||
// chown only succeeds if run under priviledged user (root)
|
// chown only succeeds if run under priviledged user (root)
|
||||||
|
@ -114,7 +123,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownSyncWithUrl() {
|
async function chownSyncWithUrl() {
|
||||||
const { uid, gid } = await getUidAndGid();
|
const { uid, gid } = await getUidAndGid();
|
||||||
const dirPath = Deno.makeTempDirSync();
|
const dirPath = Deno.makeTempDirSync();
|
||||||
|
@ -126,7 +138,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownSucceed() {
|
async function chownSucceed() {
|
||||||
const { uid, gid } = await getUidAndGid();
|
const { uid, gid } = await getUidAndGid();
|
||||||
const dirPath = await Deno.makeTempDir();
|
const dirPath = await Deno.makeTempDir();
|
||||||
|
@ -138,7 +153,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownUidOnly() {
|
async function chownUidOnly() {
|
||||||
const { uid } = await getUidAndGid();
|
const { uid } = await getUidAndGid();
|
||||||
const dirPath = await Deno.makeTempDir();
|
const dirPath = await Deno.makeTempDir();
|
||||||
|
@ -150,7 +168,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true }, ignore: Deno.build.os == "windows" },
|
{
|
||||||
|
permissions: { run: true, write: true },
|
||||||
|
ignore: Deno.build.os == "windows",
|
||||||
|
},
|
||||||
async function chownWithUrl() {
|
async function chownWithUrl() {
|
||||||
// TODO(bartlomieju): same as chownSyncSucceed
|
// TODO(bartlomieju): same as chownSyncSucceed
|
||||||
const { uid, gid } = await getUidAndGid();
|
const { uid, gid } = await getUidAndGid();
|
||||||
|
|
|
@ -28,7 +28,7 @@ function assertSameContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function copyFileSyncSuccess() {
|
function copyFileSyncSuccess() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -45,7 +45,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function copyFileSyncByUrl() {
|
function copyFileSyncByUrl() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromUrl = new URL(
|
const fromUrl = new URL(
|
||||||
|
@ -66,7 +66,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
function copyFileSyncFailure() {
|
function copyFileSyncFailure() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -81,7 +81,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: false } },
|
{ permissions: { write: true, read: false } },
|
||||||
function copyFileSyncPerm1() {
|
function copyFileSyncPerm1() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.copyFileSync("/from.txt", "/to.txt");
|
Deno.copyFileSync("/from.txt", "/to.txt");
|
||||||
|
@ -90,7 +90,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: false, read: true } },
|
{ permissions: { write: false, read: true } },
|
||||||
function copyFileSyncPerm2() {
|
function copyFileSyncPerm2() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.copyFileSync("/from.txt", "/to.txt");
|
Deno.copyFileSync("/from.txt", "/to.txt");
|
||||||
|
@ -99,7 +99,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function copyFileSyncOverwrite() {
|
function copyFileSyncOverwrite() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -118,7 +118,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function copyFileSuccess() {
|
async function copyFileSuccess() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -135,7 +135,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function copyFileByUrl() {
|
async function copyFileByUrl() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromUrl = new URL(
|
const fromUrl = new URL(
|
||||||
|
@ -156,7 +156,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function copyFileFailure() {
|
async function copyFileFailure() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -171,7 +171,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function copyFileOverwrite() {
|
async function copyFileOverwrite() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fromFilename = tempDir + "/from.txt";
|
const fromFilename = tempDir + "/from.txt";
|
||||||
|
@ -190,7 +190,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: false, write: true } },
|
{ permissions: { read: false, write: true } },
|
||||||
async function copyFilePerm1() {
|
async function copyFilePerm1() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.copyFile("/from.txt", "/to.txt");
|
await Deno.copyFile("/from.txt", "/to.txt");
|
||||||
|
@ -199,7 +199,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
async function copyFilePerm2() {
|
async function copyFilePerm2() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.copyFile("/from.txt", "/to.txt");
|
await Deno.copyFile("/from.txt", "/to.txt");
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
||||||
import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function dirCwdNotNull() {
|
unitTest({ permissions: { read: true } }, function dirCwdNotNull() {
|
||||||
assert(Deno.cwd() != null);
|
assert(Deno.cwd() != null);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function dirCwdChdirSuccess() {
|
function dirCwdChdirSuccess() {
|
||||||
const initialdir = Deno.cwd();
|
const initialdir = Deno.cwd();
|
||||||
const path = Deno.makeTempDirSync();
|
const path = Deno.makeTempDirSync();
|
||||||
|
@ -21,7 +21,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true, write: true } }, function dirCwdError() {
|
unitTest({ permissions: { read: true, write: true } }, function dirCwdError() {
|
||||||
// excluding windows since it throws resource busy, while removeSync
|
// excluding windows since it throws resource busy, while removeSync
|
||||||
if (["linux", "darwin"].includes(Deno.build.os)) {
|
if (["linux", "darwin"].includes(Deno.build.os)) {
|
||||||
const initialdir = Deno.cwd();
|
const initialdir = Deno.cwd();
|
||||||
|
@ -38,7 +38,7 @@ unitTest({ perms: { read: true, write: true } }, function dirCwdError() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function dirCwdPermError() {
|
unitTest({ permissions: { read: false } }, function dirCwdPermError() {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
Deno.cwd();
|
Deno.cwd();
|
||||||
|
@ -49,7 +49,7 @@ unitTest({ perms: { read: false } }, function dirCwdPermError() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function dirChdirError() {
|
function dirChdirError() {
|
||||||
const path = Deno.makeTempDirSync() + "test";
|
const path = Deno.makeTempDirSync() + "test";
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
import { Buffer } from "../../../test_util/std/io/buffer.ts";
|
import { Buffer } from "../../../test_util/std/io/buffer.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchRequiresOneArgument() {
|
async function fetchRequiresOneArgument() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
fetch as unknown as () => Promise<void>,
|
fetch as unknown as () => Promise<void>,
|
||||||
|
@ -20,7 +20,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchProtocolError() {
|
unitTest({ permissions: { net: true } }, async function fetchProtocolError() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
await fetch("file:///");
|
await fetch("file:///");
|
||||||
|
@ -55,7 +55,7 @@ function findClosedPortInRange(
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchConnectionError() {
|
async function fetchConnectionError() {
|
||||||
const port = findClosedPortInRange(4000, 9999);
|
const port = findClosedPortInRange(4000, 9999);
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
|
@ -69,7 +69,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchDnsError() {
|
async function fetchDnsError() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
|
@ -82,7 +82,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInvalidUriError() {
|
async function fetchInvalidUriError() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
|
@ -93,7 +93,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchJsonSuccess() {
|
unitTest({ permissions: { net: true } }, async function fetchJsonSuccess() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
assertEquals(json.name, "deno");
|
assertEquals(json.name, "deno");
|
||||||
|
@ -105,13 +105,13 @@ unitTest(async function fetchPerm() {
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchUrl() {
|
unitTest({ permissions: { net: true } }, async function fetchUrl() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
assertEquals(response.url, "http://localhost:4545/fixture.json");
|
assertEquals(response.url, "http://localhost:4545/fixture.json");
|
||||||
const _json = await response.json();
|
const _json = await response.json();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchURL() {
|
unitTest({ permissions: { net: true } }, async function fetchURL() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
new URL("http://localhost:4545/fixture.json"),
|
new URL("http://localhost:4545/fixture.json"),
|
||||||
);
|
);
|
||||||
|
@ -119,14 +119,14 @@ unitTest({ perms: { net: true } }, async function fetchURL() {
|
||||||
const _json = await response.json();
|
const _json = await response.json();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchHeaders() {
|
unitTest({ permissions: { net: true } }, async function fetchHeaders() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const headers = response.headers;
|
const headers = response.headers;
|
||||||
assertEquals(headers.get("Content-Type"), "application/json");
|
assertEquals(headers.get("Content-Type"), "application/json");
|
||||||
const _json = await response.json();
|
const _json = await response.json();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchBlob() {
|
unitTest({ permissions: { net: true } }, async function fetchBlob() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const headers = response.headers;
|
const headers = response.headers;
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
|
@ -135,7 +135,7 @@ unitTest({ perms: { net: true } }, async function fetchBlob() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyUsedReader() {
|
async function fetchBodyUsedReader() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/fixture.json",
|
"http://localhost:4545/fixture.json",
|
||||||
|
@ -153,7 +153,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyUsedCancelStream() {
|
async function fetchBodyUsedCancelStream() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/fixture.json",
|
"http://localhost:4545/fixture.json",
|
||||||
|
@ -167,7 +167,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchAsyncIterator() {
|
unitTest({ permissions: { net: true } }, async function fetchAsyncIterator() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const headers = response.headers;
|
const headers = response.headers;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ unitTest({ perms: { net: true } }, async function fetchAsyncIterator() {
|
||||||
assertEquals(total, Number(headers.get("Content-Length")));
|
assertEquals(total, Number(headers.get("Content-Length")));
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchBodyReader() {
|
unitTest({ permissions: { net: true } }, async function fetchBodyReader() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const headers = response.headers;
|
const headers = response.headers;
|
||||||
assert(response.body !== null);
|
assert(response.body !== null);
|
||||||
|
@ -199,7 +199,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReader() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyReaderBigBody() {
|
async function fetchBodyReaderBigBody() {
|
||||||
const data = "a".repeat(10 << 10); // 10mb
|
const data = "a".repeat(10 << 10); // 10mb
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
|
@ -220,7 +220,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function responseClone() {
|
unitTest({ permissions: { net: true } }, async function responseClone() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
const response1 = response.clone();
|
const response1 = response.clone();
|
||||||
assert(response !== response1);
|
assert(response !== response1);
|
||||||
|
@ -234,7 +234,7 @@ unitTest({ perms: { net: true } }, async function responseClone() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchMultipartFormDataSuccess() {
|
async function fetchMultipartFormDataSuccess() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/multipart_form_data.txt",
|
"http://localhost:4545/multipart_form_data.txt",
|
||||||
|
@ -251,7 +251,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchMultipartFormBadContentType() {
|
async function fetchMultipartFormBadContentType() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/multipart_form_bad_content_type",
|
"http://localhost:4545/multipart_form_bad_content_type",
|
||||||
|
@ -269,7 +269,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchURLEncodedFormDataSuccess() {
|
async function fetchURLEncodedFormDataSuccess() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/subdir/form_urlencoded.txt",
|
"http://localhost:4545/subdir/form_urlencoded.txt",
|
||||||
|
@ -283,7 +283,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitFormDataBinaryFileBody() {
|
async function fetchInitFormDataBinaryFileBody() {
|
||||||
// Some random bytes
|
// Some random bytes
|
||||||
// deno-fmt-ignore
|
// deno-fmt-ignore
|
||||||
|
@ -302,7 +302,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitFormDataMultipleFilesBody() {
|
async function fetchInitFormDataMultipleFilesBody() {
|
||||||
const files = [
|
const files = [
|
||||||
{
|
{
|
||||||
|
@ -357,7 +357,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithRedirection() {
|
async function fetchWithRedirection() {
|
||||||
const response = await fetch("http://localhost:4546/hello.txt");
|
const response = await fetch("http://localhost:4546/hello.txt");
|
||||||
|
@ -371,7 +371,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithRelativeRedirection() {
|
async function fetchWithRelativeRedirection() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
|
@ -386,7 +386,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithRelativeRedirectionUrl() {
|
async function fetchWithRelativeRedirectionUrl() {
|
||||||
const cases = [
|
const cases = [
|
||||||
|
@ -407,7 +407,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithInfRedirection() {
|
async function fetchWithInfRedirection() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
|
@ -419,7 +419,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitStringBody() {
|
async function fetchInitStringBody() {
|
||||||
const data = "Hello World";
|
const data = "Hello World";
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
|
@ -433,7 +433,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchRequestInitStringBody() {
|
async function fetchRequestInitStringBody() {
|
||||||
const data = "Hello World";
|
const data = "Hello World";
|
||||||
const req = new Request("http://localhost:4545/echo_server", {
|
const req = new Request("http://localhost:4545/echo_server", {
|
||||||
|
@ -447,7 +447,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchSeparateInit() {
|
async function fetchSeparateInit() {
|
||||||
// related to: https://github.com/denoland/deno/issues/10396
|
// related to: https://github.com/denoland/deno/issues/10396
|
||||||
const req = new Request("http://localhost:4545/001_hello.js");
|
const req = new Request("http://localhost:4545/001_hello.js");
|
||||||
|
@ -462,7 +462,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitTypedArrayBody() {
|
async function fetchInitTypedArrayBody() {
|
||||||
const data = "Hello World";
|
const data = "Hello World";
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
|
@ -475,7 +475,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitArrayBufferBody() {
|
async function fetchInitArrayBufferBody() {
|
||||||
const data = "Hello World";
|
const data = "Hello World";
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
|
@ -488,7 +488,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitURLSearchParamsBody() {
|
async function fetchInitURLSearchParamsBody() {
|
||||||
const data = "param1=value1¶m2=value2";
|
const data = "param1=value1¶m2=value2";
|
||||||
const params = new URLSearchParams(data);
|
const params = new URLSearchParams(data);
|
||||||
|
@ -506,7 +506,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchInitBlobBody() {
|
unitTest({ permissions: { net: true } }, async function fetchInitBlobBody() {
|
||||||
const data = "const a = 1";
|
const data = "const a = 1";
|
||||||
const blob = new Blob([data], {
|
const blob = new Blob([data], {
|
||||||
type: "text/javascript",
|
type: "text/javascript",
|
||||||
|
@ -521,7 +521,7 @@ unitTest({ perms: { net: true } }, async function fetchInitBlobBody() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitFormDataBody() {
|
async function fetchInitFormDataBody() {
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append("field", "value");
|
form.append("field", "value");
|
||||||
|
@ -535,7 +535,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitFormDataBlobFilenameBody() {
|
async function fetchInitFormDataBlobFilenameBody() {
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append("field", "value");
|
form.append("field", "value");
|
||||||
|
@ -553,7 +553,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchInitFormDataTextFileBody() {
|
async function fetchInitFormDataTextFileBody() {
|
||||||
const fileContent = "deno land";
|
const fileContent = "deno land";
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
|
@ -582,7 +582,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchUserAgent() {
|
unitTest({ permissions: { net: true } }, async function fetchUserAgent() {
|
||||||
const data = "Hello World";
|
const data = "Hello World";
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -621,7 +621,7 @@ function bufferServer(addr: string): Promise<Buffer> {
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchRequest() {
|
async function fetchRequest() {
|
||||||
const addr = "127.0.0.1:4501";
|
const addr = "127.0.0.1:4501";
|
||||||
|
@ -653,7 +653,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchPostBodyString() {
|
async function fetchPostBodyString() {
|
||||||
const addr = "127.0.0.1:4502";
|
const addr = "127.0.0.1:4502";
|
||||||
|
@ -690,7 +690,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchPostBodyTypedArray() {
|
async function fetchPostBodyTypedArray() {
|
||||||
const addr = "127.0.0.1:4503";
|
const addr = "127.0.0.1:4503";
|
||||||
|
@ -727,7 +727,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithNonAsciiRedirection() {
|
async function fetchWithNonAsciiRedirection() {
|
||||||
const response = await fetch("http://localhost:4545/non_ascii_redirect", {
|
const response = await fetch("http://localhost:4545/non_ascii_redirect", {
|
||||||
|
@ -741,7 +741,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithManualRedirection() {
|
async function fetchWithManualRedirection() {
|
||||||
const response = await fetch("http://localhost:4546/", {
|
const response = await fetch("http://localhost:4546/", {
|
||||||
|
@ -757,7 +757,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchWithErrorRedirection() {
|
async function fetchWithErrorRedirection() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
|
@ -795,7 +795,7 @@ unitTest(async function responseWithoutBody() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function fetchBodyReadTwice() {
|
unitTest({ permissions: { net: true } }, async function fetchBodyReadTwice() {
|
||||||
const response = await fetch("http://localhost:4545/fixture.json");
|
const response = await fetch("http://localhost:4545/fixture.json");
|
||||||
|
|
||||||
// Read body
|
// Read body
|
||||||
|
@ -817,7 +817,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyReaderAfterRead() {
|
async function fetchBodyReaderAfterRead() {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
"http://localhost:4545/fixture.json",
|
"http://localhost:4545/fixture.json",
|
||||||
|
@ -840,7 +840,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyReaderWithCancelAndNewReader() {
|
async function fetchBodyReaderWithCancelAndNewReader() {
|
||||||
const data = "a".repeat(1 << 10);
|
const data = "a".repeat(1 << 10);
|
||||||
const response = await fetch("http://localhost:4545/echo_server", {
|
const response = await fetch("http://localhost:4545/echo_server", {
|
||||||
|
@ -868,7 +868,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchBodyReaderWithReadCancelAndNewReader() {
|
async function fetchBodyReaderWithReadCancelAndNewReader() {
|
||||||
const data = "a".repeat(1 << 10);
|
const data = "a".repeat(1 << 10);
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchResourceCloseAfterStreamCancel() {
|
async function fetchResourceCloseAfterStreamCancel() {
|
||||||
const res = await fetch("http://localhost:4545/fixture.json");
|
const res = await fetch("http://localhost:4545/fixture.json");
|
||||||
assert(res.body !== null);
|
assert(res.body !== null);
|
||||||
|
@ -916,7 +916,7 @@ unitTest(
|
||||||
// connection error: An established connection was aborted by
|
// connection error: An established connection was aborted by
|
||||||
// the software in your host machine. (os error 10053)
|
// the software in your host machine. (os error 10053)
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true }, ignore: Deno.build.os == "windows" },
|
{ permissions: { net: true }, ignore: Deno.build.os == "windows" },
|
||||||
async function fetchNullBodyStatus() {
|
async function fetchNullBodyStatus() {
|
||||||
const nullBodyStatus = [101, 204, 205, 304];
|
const nullBodyStatus = [101, 204, 205, 304];
|
||||||
|
|
||||||
|
@ -934,7 +934,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchResponseContentLength() {
|
async function fetchResponseContentLength() {
|
||||||
const body = new Uint8Array(2 ** 16);
|
const body = new Uint8Array(2 ** 16);
|
||||||
const headers = new Headers([["content-type", "application/octet-stream"]]);
|
const headers = new Headers([["content-type", "application/octet-stream"]]);
|
||||||
|
@ -999,7 +999,7 @@ unitTest(function fetchResponseEmptyConstructor() {
|
||||||
|
|
||||||
// TODO(lucacasonato): reenable this test
|
// TODO(lucacasonato): reenable this test
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true }, ignore: true },
|
{ permissions: { net: true }, ignore: true },
|
||||||
async function fetchCustomHttpClientParamCertificateSuccess(): Promise<
|
async function fetchCustomHttpClientParamCertificateSuccess(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -1038,7 +1038,7 @@ MNf4EgWfK+tZMnuqfpfO9740KzfcVoMNo4QJD4yn5YxroUOO/Azi
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchCustomClientUserAgent(): Promise<
|
async function fetchCustomClientUserAgent(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -1060,7 +1060,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function fetchPostBodyReadableStream() {
|
async function fetchPostBodyReadableStream() {
|
||||||
const addr = "127.0.0.1:4502";
|
const addr = "127.0.0.1:4502";
|
||||||
|
@ -1146,7 +1146,7 @@ function returnHostHeaderServer(addr: string): Deno.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchFilterOutCustomHostHeader(): Promise<
|
async function fetchFilterOutCustomHostHeader(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -1163,7 +1163,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchNoServerReadableStreamBody() {
|
async function fetchNoServerReadableStreamBody() {
|
||||||
const done = deferred();
|
const done = deferred();
|
||||||
const body = new ReadableStream({
|
const body = new ReadableStream({
|
||||||
|
@ -1184,7 +1184,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchHeadRespBody() {
|
async function fetchHeadRespBody() {
|
||||||
const res = await fetch("http://localhost:4545/echo_server", {
|
const res = await fetch("http://localhost:4545/echo_server", {
|
||||||
method: "HEAD",
|
method: "HEAD",
|
||||||
|
@ -1194,7 +1194,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchClientCertWrongPrivateKey(): Promise<void> {
|
async function fetchClientCertWrongPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
const client = Deno.createHttpClient({
|
const client = Deno.createHttpClient({
|
||||||
|
@ -1211,7 +1211,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchClientCertBadPrivateKey(): Promise<void> {
|
async function fetchClientCertBadPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
const client = Deno.createHttpClient({
|
const client = Deno.createHttpClient({
|
||||||
|
@ -1228,7 +1228,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchClientCertNotPrivateKey(): Promise<void> {
|
async function fetchClientCertNotPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
const client = Deno.createHttpClient({
|
const client = Deno.createHttpClient({
|
||||||
|
@ -1245,7 +1245,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function fetchCustomClientPrivateKey(): Promise<
|
async function fetchCustomClientPrivateKey(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -1274,7 +1274,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function fetchAbortWhileUploadStreaming(): Promise<void> {
|
async function fetchAbortWhileUploadStreaming(): Promise<void> {
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { assertThrows, unitTest } from "./test_util.ts";
|
import { assertThrows, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { ffi: true } }, function dlopenInvalidArguments() {
|
unitTest({ permissions: { ffi: true } }, function dlopenInvalidArguments() {
|
||||||
const filename = "/usr/lib/libc.so.6";
|
const filename = "/usr/lib/libc.so.6";
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
// @ts-expect-error: ForeignFunction cannot be null
|
// @ts-expect-error: ForeignFunction cannot be null
|
||||||
|
|
|
@ -101,7 +101,7 @@ unitTest(function fileUsingEmptyStringFileName() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function fileTruncateSyncSuccess() {
|
function fileTruncateSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_fileTruncateSync.txt";
|
const filename = Deno.makeTempDirSync() + "/test_fileTruncateSync.txt";
|
||||||
const file = Deno.openSync(filename, {
|
const file = Deno.openSync(filename, {
|
||||||
|
@ -123,7 +123,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function fileTruncateSuccess() {
|
async function fileTruncateSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_fileTruncate.txt";
|
const filename = Deno.makeTempDirSync() + "/test_fileTruncate.txt";
|
||||||
const file = await Deno.open(filename, {
|
const file = await Deno.open(filename, {
|
||||||
|
@ -144,7 +144,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function fileStatSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function fileStatSyncSuccess() {
|
||||||
const file = Deno.openSync("README.md");
|
const file = Deno.openSync("README.md");
|
||||||
const fileInfo = file.statSync();
|
const fileInfo = file.statSync();
|
||||||
assert(fileInfo.isFile);
|
assert(fileInfo.isFile);
|
||||||
|
@ -159,7 +159,7 @@ unitTest({ perms: { read: true } }, function fileStatSyncSuccess() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function fileStatSuccess() {
|
unitTest({ permissions: { read: true } }, async function fileStatSuccess() {
|
||||||
const file = await Deno.open("README.md");
|
const file = await Deno.open("README.md");
|
||||||
const fileInfo = await file.stat();
|
const fileInfo = await file.stat();
|
||||||
assert(fileInfo.isFile);
|
assert(fileInfo.isFile);
|
||||||
|
|
|
@ -11,7 +11,7 @@ unitTest(function filesStdioFileDescriptors() {
|
||||||
assertEquals(Deno.stderr.rid, 2);
|
assertEquals(Deno.stderr.rid, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function filesCopyToStdout() {
|
unitTest({ permissions: { read: true } }, async function filesCopyToStdout() {
|
||||||
const filename = "cli/tests/testdata/fixture.json";
|
const filename = "cli/tests/testdata/fixture.json";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
assert(file.rid > 2);
|
assert(file.rid > 2);
|
||||||
|
@ -21,7 +21,7 @@ unitTest({ perms: { read: true } }, async function filesCopyToStdout() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function filesIter() {
|
unitTest({ permissions: { read: true } }, async function filesIter() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ unitTest({ perms: { read: true } }, async function filesIter() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function filesIterCustomBufSize() {
|
async function filesIterCustomBufSize() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
|
@ -53,7 +53,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function filesIterSync() {
|
unitTest({ permissions: { read: true } }, function filesIterSync() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = Deno.openSync(filename);
|
const file = Deno.openSync(filename);
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ unitTest({ perms: { read: true } }, function filesIterSync() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
function filesIterSyncCustomBufSize() {
|
function filesIterSyncCustomBufSize() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = Deno.openSync(filename);
|
const file = Deno.openSync(filename);
|
||||||
|
@ -157,7 +157,7 @@ unitTest(async function readerIterSync() {
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
function openSyncMode() {
|
function openSyncMode() {
|
||||||
const path = Deno.makeTempDirSync() + "/test_openSync.txt";
|
const path = Deno.makeTempDirSync() + "/test_openSync.txt";
|
||||||
|
@ -176,7 +176,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
async function openMode() {
|
async function openMode() {
|
||||||
const path = (await Deno.makeTempDir()) + "/test_open.txt";
|
const path = (await Deno.makeTempDir()) + "/test_open.txt";
|
||||||
|
@ -195,7 +195,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
function openSyncUrl() {
|
function openSyncUrl() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
|
@ -221,7 +221,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
async function openUrl() {
|
async function openUrl() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
|
@ -246,7 +246,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: false } },
|
{ permissions: { write: false } },
|
||||||
async function writePermFailure() {
|
async function writePermFailure() {
|
||||||
const filename = "tests/hello.txt";
|
const filename = "tests/hello.txt";
|
||||||
const openOptions: Deno.OpenOptions[] = [{ write: true }, { append: true }];
|
const openOptions: Deno.OpenOptions[] = [{ write: true }, { append: true }];
|
||||||
|
@ -293,14 +293,14 @@ unitTest(async function openOptions() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function readPermFailure() {
|
unitTest({ permissions: { read: false } }, async function readPermFailure() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.open("package.json", { read: true });
|
await Deno.open("package.json", { read: true });
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true } },
|
{ permissions: { write: true } },
|
||||||
async function writeNullBufferFailure() {
|
async function writeNullBufferFailure() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const filename = tempDir + "hello.txt";
|
const filename = tempDir + "hello.txt";
|
||||||
|
@ -324,7 +324,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function readNullBufferFailure() {
|
async function readNullBufferFailure() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const filename = tempDir + "hello.txt";
|
const filename = tempDir + "hello.txt";
|
||||||
|
@ -352,7 +352,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: false, read: false } },
|
{ permissions: { write: false, read: false } },
|
||||||
async function readWritePermFailure() {
|
async function readWritePermFailure() {
|
||||||
const filename = "tests/hello.txt";
|
const filename = "tests/hello.txt";
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
|
@ -362,7 +362,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function createFile() {
|
async function createFile() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const filename = tempDir + "/test.txt";
|
const filename = tempDir + "/test.txt";
|
||||||
|
@ -383,7 +383,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function createFileWithUrl() {
|
async function createFileWithUrl() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const fileUrl = new URL(
|
const fileUrl = new URL(
|
||||||
|
@ -405,7 +405,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function createSyncFile() {
|
async function createSyncFile() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const filename = tempDir + "/test.txt";
|
const filename = tempDir + "/test.txt";
|
||||||
|
@ -426,7 +426,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function createSyncFileWithUrl() {
|
async function createSyncFileWithUrl() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const fileUrl = new URL(
|
const fileUrl = new URL(
|
||||||
|
@ -448,7 +448,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function openModeWrite() {
|
async function openModeWrite() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
@ -491,7 +491,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function openModeWriteRead() {
|
async function openModeWriteRead() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
@ -526,7 +526,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function seekStart() {
|
unitTest({ permissions: { read: true } }, async function seekStart() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
const seekPosition = 6;
|
const seekPosition = 6;
|
||||||
|
@ -543,7 +543,7 @@ unitTest({ perms: { read: true } }, async function seekStart() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function seekSyncStart() {
|
unitTest({ permissions: { read: true } }, function seekSyncStart() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = Deno.openSync(filename);
|
const file = Deno.openSync(filename);
|
||||||
const seekPosition = 6;
|
const seekPosition = 6;
|
||||||
|
@ -560,7 +560,7 @@ unitTest({ perms: { read: true } }, function seekSyncStart() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function seekCurrent() {
|
unitTest({ permissions: { read: true } }, async function seekCurrent() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
// Deliberately move 1 step forward
|
// Deliberately move 1 step forward
|
||||||
|
@ -577,7 +577,7 @@ unitTest({ perms: { read: true } }, async function seekCurrent() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function seekSyncCurrent() {
|
unitTest({ permissions: { read: true } }, function seekSyncCurrent() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = Deno.openSync(filename);
|
const file = Deno.openSync(filename);
|
||||||
// Deliberately move 1 step forward
|
// Deliberately move 1 step forward
|
||||||
|
@ -594,7 +594,7 @@ unitTest({ perms: { read: true } }, function seekSyncCurrent() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function seekEnd() {
|
unitTest({ permissions: { read: true } }, async function seekEnd() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
const seekPosition = -6;
|
const seekPosition = -6;
|
||||||
|
@ -608,7 +608,7 @@ unitTest({ perms: { read: true } }, async function seekEnd() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function seekSyncEnd() {
|
unitTest({ permissions: { read: true } }, function seekSyncEnd() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = Deno.openSync(filename);
|
const file = Deno.openSync(filename);
|
||||||
const seekPosition = -6;
|
const seekPosition = -6;
|
||||||
|
@ -622,7 +622,7 @@ unitTest({ perms: { read: true } }, function seekSyncEnd() {
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function seekMode() {
|
unitTest({ permissions: { read: true } }, async function seekMode() {
|
||||||
const filename = "cli/tests/testdata/hello.txt";
|
const filename = "cli/tests/testdata/hello.txt";
|
||||||
const file = await Deno.open(filename);
|
const file = await Deno.open(filename);
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
|
|
|
@ -3,14 +3,14 @@ import { assertEquals, unitTest } from "./test_util.ts";
|
||||||
import { readAll } from "../../../test_util/std/io/util.ts";
|
import { readAll } from "../../../test_util/std/io/util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, run: true, hrtime: true } },
|
{ permissions: { read: true, run: true, hrtime: true } },
|
||||||
async function flockFileSync() {
|
async function flockFileSync() {
|
||||||
await runFlockTests({ sync: true });
|
await runFlockTests({ sync: true });
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, run: true, hrtime: true } },
|
{ permissions: { read: true, run: true, hrtime: true } },
|
||||||
async function flockFileAsync() {
|
async function flockFileAsync() {
|
||||||
await runFlockTests({ sync: false });
|
await runFlockTests({ sync: false });
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,13 +3,13 @@ import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
// TODO(ry) Add more tests to specify format.
|
// TODO(ry) Add more tests to specify format.
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function watchFsPermissions() {
|
unitTest({ permissions: { read: false } }, function watchFsPermissions() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.watchFs(".");
|
Deno.watchFs(".");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function watchFsInvalidPath() {
|
unitTest({ permissions: { read: true } }, function watchFsInvalidPath() {
|
||||||
if (Deno.build.os === "windows") {
|
if (Deno.build.os === "windows") {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
|
@ -37,7 +37,7 @@ async function getTwoEvents(
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function watchFsBasic() {
|
async function watchFsBasic() {
|
||||||
const testDir = await Deno.makeTempDir();
|
const testDir = await Deno.makeTempDir();
|
||||||
const iter = Deno.watchFs(testDir);
|
const iter = Deno.watchFs(testDir);
|
||||||
|
@ -64,7 +64,7 @@ unitTest(
|
||||||
// TODO(kt3k): This test is for the backward compatibility of `.return` method.
|
// TODO(kt3k): This test is for the backward compatibility of `.return` method.
|
||||||
// This should be removed at 2.0
|
// This should be removed at 2.0
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function watchFsReturn() {
|
async function watchFsReturn() {
|
||||||
const testDir = await Deno.makeTempDir();
|
const testDir = await Deno.makeTempDir();
|
||||||
const iter = Deno.watchFs(testDir);
|
const iter = Deno.watchFs(testDir);
|
||||||
|
@ -82,7 +82,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function watchFsClose() {
|
async function watchFsClose() {
|
||||||
const testDir = await Deno.makeTempDir();
|
const testDir = await Deno.makeTempDir();
|
||||||
const iter = Deno.watchFs(testDir);
|
const iter = Deno.watchFs(testDir);
|
||||||
|
|
|
@ -41,7 +41,7 @@ async function writeRequestAndReadResponse(conn: Deno.Conn): Promise<string> {
|
||||||
return decoder.decode(dest.bytes());
|
return decoder.decode(dest.bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpServerBasic() {
|
unitTest({ permissions: { net: true } }, async function httpServerBasic() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
for await (const conn of listener) {
|
for await (const conn of listener) {
|
||||||
|
@ -68,7 +68,7 @@ unitTest({ perms: { net: true } }, async function httpServerBasic() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerStreamResponse() {
|
async function httpServerStreamResponse() {
|
||||||
const stream = new TransformStream();
|
const stream = new TransformStream();
|
||||||
const writer = stream.writable.getWriter();
|
const writer = stream.writable.getWriter();
|
||||||
|
@ -97,7 +97,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerStreamRequest() {
|
async function httpServerStreamRequest() {
|
||||||
const stream = new TransformStream();
|
const stream = new TransformStream();
|
||||||
const writer = stream.writable.getWriter();
|
const writer = stream.writable.getWriter();
|
||||||
|
@ -135,7 +135,9 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpServerStreamDuplex() {
|
unitTest(
|
||||||
|
{ permissions: { net: true } },
|
||||||
|
async function httpServerStreamDuplex() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
const conn = await listener.accept();
|
const conn = await listener.accept();
|
||||||
|
@ -169,9 +171,10 @@ unitTest({ perms: { net: true } }, async function httpServerStreamDuplex() {
|
||||||
const chunk3 = await reader.read();
|
const chunk3 = await reader.read();
|
||||||
assert(chunk3.done);
|
assert(chunk3.done);
|
||||||
await promise;
|
await promise;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpServerClose() {
|
unitTest({ permissions: { net: true } }, async function httpServerClose() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
const client = await Deno.connect({ port: 4501 });
|
const client = await Deno.connect({ port: 4501 });
|
||||||
const httpConn = Deno.serveHttp(await listener.accept());
|
const httpConn = Deno.serveHttp(await listener.accept());
|
||||||
|
@ -182,7 +185,9 @@ unitTest({ perms: { net: true } }, async function httpServerClose() {
|
||||||
listener.close();
|
listener.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpServerInvalidMethod() {
|
unitTest(
|
||||||
|
{ permissions: { net: true } },
|
||||||
|
async function httpServerInvalidMethod() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
const client = await Deno.connect({ port: 4501 });
|
const client = await Deno.connect({ port: 4501 });
|
||||||
const httpConn = Deno.serveHttp(await listener.accept());
|
const httpConn = Deno.serveHttp(await listener.accept());
|
||||||
|
@ -197,10 +202,11 @@ unitTest({ perms: { net: true } }, async function httpServerInvalidMethod() {
|
||||||
// Note httpConn is automatically closed when it errors.
|
// Note httpConn is automatically closed when it errors.
|
||||||
client.close();
|
client.close();
|
||||||
listener.close();
|
listener.close();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function httpServerWithTls() {
|
async function httpServerWithTls() {
|
||||||
const hostname = "localhost";
|
const hostname = "localhost";
|
||||||
const port = 4501;
|
const port = 4501;
|
||||||
|
@ -241,7 +247,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerRegressionHang() {
|
async function httpServerRegressionHang() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -268,7 +274,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerCancelBodyOnResponseFailure() {
|
async function httpServerCancelBodyOnResponseFailure() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -313,7 +319,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerNextRequestErrorExposedInResponse() {
|
async function httpServerNextRequestErrorExposedInResponse() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -358,7 +364,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerEmptyBlobResponse() {
|
async function httpServerEmptyBlobResponse() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -380,7 +386,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerNextRequestResolvesOnClose() {
|
async function httpServerNextRequestResolvesOnClose() {
|
||||||
const httpConnList: Deno.HttpConn[] = [];
|
const httpConnList: Deno.HttpConn[] = [];
|
||||||
|
|
||||||
|
@ -412,7 +418,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
// Issue: https://github.com/denoland/deno/issues/10870
|
// Issue: https://github.com/denoland/deno/issues/10870
|
||||||
async function httpServerHang() {
|
async function httpServerHang() {
|
||||||
// Quick and dirty way to make a readable stream from a string. Alternatively,
|
// Quick and dirty way to make a readable stream from a string. Alternatively,
|
||||||
|
@ -458,7 +464,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
// Issue: https://github.com/denoland/deno/issues/10930
|
// Issue: https://github.com/denoland/deno/issues/10930
|
||||||
async function httpServerStreamingResponse() {
|
async function httpServerStreamingResponse() {
|
||||||
// This test enqueues a single chunk for readable
|
// This test enqueues a single chunk for readable
|
||||||
|
@ -547,7 +553,9 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpRequestLatin1Headers() {
|
unitTest(
|
||||||
|
{ permissions: { net: true } },
|
||||||
|
async function httpRequestLatin1Headers() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
for await (const conn of listener) {
|
for await (const conn of listener) {
|
||||||
|
@ -588,10 +596,11 @@ unitTest({ perms: { net: true } }, async function httpRequestLatin1Headers() {
|
||||||
assert(/\r\n[Xx]-[Hh]eader-[Tt]est: Æ\r\n/.test(responseText));
|
assert(/\r\n[Xx]-[Hh]eader-[Tt]est: Æ\r\n/.test(responseText));
|
||||||
|
|
||||||
await promise;
|
await promise;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerRequestWithoutPath() {
|
async function httpServerRequestWithoutPath() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -635,7 +644,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpServerWebSocket() {
|
unitTest({ permissions: { net: true } }, async function httpServerWebSocket() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
for await (const conn of listener) {
|
for await (const conn of listener) {
|
||||||
|
@ -752,7 +761,9 @@ unitTest(function httpUpgradeWebSocketWithoutUpgradeHeader() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function httpCookieConcatenation() {
|
unitTest(
|
||||||
|
{ permissions: { net: true } },
|
||||||
|
async function httpCookieConcatenation() {
|
||||||
const promise = (async () => {
|
const promise = (async () => {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
for await (const conn of listener) {
|
for await (const conn of listener) {
|
||||||
|
@ -777,10 +788,11 @@ unitTest({ perms: { net: true } }, async function httpCookieConcatenation() {
|
||||||
const text = await resp.text();
|
const text = await resp.text();
|
||||||
assertEquals(text, "ok");
|
assertEquals(text, "ok");
|
||||||
await promise;
|
await promise;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// https://github.com/denoland/deno/issues/11651
|
// https://github.com/denoland/deno/issues/11651
|
||||||
unitTest({ perms: { net: true } }, async function httpServerPanic() {
|
unitTest({ permissions: { net: true } }, async function httpServerPanic() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
const client = await Deno.connect({ port: 4501 });
|
const client = await Deno.connect({ port: 4501 });
|
||||||
const conn = await listener.accept();
|
const conn = await listener.accept();
|
||||||
|
@ -801,7 +813,7 @@ unitTest({ perms: { net: true } }, async function httpServerPanic() {
|
||||||
|
|
||||||
// https://github.com/denoland/deno/issues/11595
|
// https://github.com/denoland/deno/issues/11595
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerIncompleteMessage() {
|
async function httpServerIncompleteMessage() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
|
||||||
|
@ -861,7 +873,7 @@ unitTest(
|
||||||
|
|
||||||
// https://github.com/denoland/deno/issues/11743
|
// https://github.com/denoland/deno/issues/11743
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerDoesntLeakResources() {
|
async function httpServerDoesntLeakResources() {
|
||||||
const listener = Deno.listen({ port: 4505 });
|
const listener = Deno.listen({ port: 4505 });
|
||||||
const [conn, clientConn] = await Promise.all([
|
const [conn, clientConn] = await Promise.all([
|
||||||
|
@ -885,7 +897,7 @@ unitTest(
|
||||||
|
|
||||||
// https://github.com/denoland/deno/issues/11926
|
// https://github.com/denoland/deno/issues/11926
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function httpServerDoesntLeakResources2() {
|
async function httpServerDoesntLeakResources2() {
|
||||||
let listener: Deno.Listener;
|
let listener: Deno.Listener;
|
||||||
let httpConn: Deno.HttpConn;
|
let httpConn: Deno.HttpConn;
|
||||||
|
|
|
@ -59,7 +59,7 @@ unitTest(async function copyWithCustomBufferSize() {
|
||||||
assertEquals(readSpy.calls, DEFAULT_BUF_SIZE / bufSize + 1);
|
assertEquals(readSpy.calls, DEFAULT_BUF_SIZE / bufSize + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, async function copyBufferToFile() {
|
unitTest({ permissions: { write: true } }, async function copyBufferToFile() {
|
||||||
const filePath = "test-file.txt";
|
const filePath = "test-file.txt";
|
||||||
// bigger than max File possible buffer 16kb
|
// bigger than max File possible buffer 16kb
|
||||||
const bufSize = 32 * 1024;
|
const bufSize = 32 * 1024;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
import { assert, assertEquals, assertThrows, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function linkSyncSuccess() {
|
function linkSyncSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldData = "Hardlink";
|
const oldData = "Hardlink";
|
||||||
|
@ -41,7 +41,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function linkSyncExists() {
|
function linkSyncExists() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldName = testDir + "/oldname";
|
const oldName = testDir + "/oldname";
|
||||||
|
@ -57,7 +57,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function linkSyncNotFound() {
|
function linkSyncNotFound() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldName = testDir + "/oldname";
|
const oldName = testDir + "/oldname";
|
||||||
|
@ -70,7 +70,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: false, write: true } },
|
{ permissions: { read: false, write: true } },
|
||||||
function linkSyncReadPerm() {
|
function linkSyncReadPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.linkSync("oldbaddir", "newbaddir");
|
Deno.linkSync("oldbaddir", "newbaddir");
|
||||||
|
@ -79,7 +79,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
function linkSyncWritePerm() {
|
function linkSyncWritePerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.linkSync("oldbaddir", "newbaddir");
|
Deno.linkSync("oldbaddir", "newbaddir");
|
||||||
|
@ -88,7 +88,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function linkSuccess() {
|
async function linkSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldData = "Hardlink";
|
const oldData = "Hardlink";
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function makeTempDirSyncSuccess() {
|
unitTest({ permissions: { write: true } }, function makeTempDirSyncSuccess() {
|
||||||
const dir1 = Deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
const dir1 = Deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
||||||
const dir2 = Deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
const dir2 = Deno.makeTempDirSync({ prefix: "hello", suffix: "world" });
|
||||||
// Check that both dirs are different.
|
// Check that both dirs are different.
|
||||||
|
@ -29,7 +29,7 @@ unitTest({ perms: { write: true } }, function makeTempDirSyncSuccess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function makeTempDirSyncMode() {
|
function makeTempDirSyncMode() {
|
||||||
const path = Deno.makeTempDirSync();
|
const path = Deno.makeTempDirSync();
|
||||||
const pathInfo = Deno.statSync(path);
|
const pathInfo = Deno.statSync(path);
|
||||||
|
@ -47,7 +47,7 @@ unitTest(function makeTempDirSyncPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true } },
|
{ permissions: { write: true } },
|
||||||
async function makeTempDirSuccess() {
|
async function makeTempDirSuccess() {
|
||||||
const dir1 = await Deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
const dir1 = await Deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
||||||
const dir2 = await Deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
const dir2 = await Deno.makeTempDir({ prefix: "hello", suffix: "world" });
|
||||||
|
@ -71,7 +71,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function makeTempDirMode() {
|
async function makeTempDirMode() {
|
||||||
const path = await Deno.makeTempDir();
|
const path = await Deno.makeTempDir();
|
||||||
const pathInfo = Deno.statSync(path);
|
const pathInfo = Deno.statSync(path);
|
||||||
|
@ -81,7 +81,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function makeTempFileSyncSuccess() {
|
unitTest({ permissions: { write: true } }, function makeTempFileSyncSuccess() {
|
||||||
const file1 = Deno.makeTempFileSync({ prefix: "hello", suffix: "world" });
|
const file1 = Deno.makeTempFileSync({ prefix: "hello", suffix: "world" });
|
||||||
const file2 = Deno.makeTempFileSync({ prefix: "hello", suffix: "world" });
|
const file2 = Deno.makeTempFileSync({ prefix: "hello", suffix: "world" });
|
||||||
// Check that both dirs are different.
|
// Check that both dirs are different.
|
||||||
|
@ -104,7 +104,7 @@ unitTest({ perms: { write: true } }, function makeTempFileSyncSuccess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function makeTempFileSyncMode() {
|
function makeTempFileSyncMode() {
|
||||||
const path = Deno.makeTempFileSync();
|
const path = Deno.makeTempFileSync();
|
||||||
const pathInfo = Deno.statSync(path);
|
const pathInfo = Deno.statSync(path);
|
||||||
|
@ -122,7 +122,7 @@ unitTest(function makeTempFileSyncPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true } },
|
{ permissions: { write: true } },
|
||||||
async function makeTempFileSuccess() {
|
async function makeTempFileSuccess() {
|
||||||
const file1 = await Deno.makeTempFile({ prefix: "hello", suffix: "world" });
|
const file1 = await Deno.makeTempFile({ prefix: "hello", suffix: "world" });
|
||||||
const file2 = await Deno.makeTempFile({ prefix: "hello", suffix: "world" });
|
const file2 = await Deno.makeTempFile({ prefix: "hello", suffix: "world" });
|
||||||
|
@ -147,7 +147,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function makeTempFileMode() {
|
async function makeTempFileMode() {
|
||||||
const path = await Deno.makeTempFile();
|
const path = await Deno.makeTempFile();
|
||||||
const pathInfo = Deno.statSync(path);
|
const pathInfo = Deno.statSync(path);
|
||||||
|
|
|
@ -40,7 +40,7 @@ unitTest(async function metrics() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true } },
|
{ permissions: { write: true } },
|
||||||
function metricsUpdatedIfNoResponseSync() {
|
function metricsUpdatedIfNoResponseSync() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true } },
|
{ permissions: { write: true } },
|
||||||
async function metricsUpdatedIfNoResponseAsync() {
|
async function metricsUpdatedIfNoResponseAsync() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function assertDirectory(path: string, mode?: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncSuccess() {
|
function mkdirSyncSuccess() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
Deno.mkdirSync(path);
|
Deno.mkdirSync(path);
|
||||||
|
@ -26,7 +26,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncMode() {
|
function mkdirSyncMode() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
Deno.mkdirSync(path, { mode: 0o737 });
|
Deno.mkdirSync(path, { mode: 0o737 });
|
||||||
|
@ -34,14 +34,14 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, function mkdirSyncPerm() {
|
unitTest({ permissions: { write: false } }, function mkdirSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.mkdirSync("/baddir");
|
Deno.mkdirSync("/baddir");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirSuccess() {
|
async function mkdirSuccess() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
await Deno.mkdir(path);
|
await Deno.mkdir(path);
|
||||||
|
@ -50,7 +50,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirMode() {
|
async function mkdirMode() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
await Deno.mkdir(path, { mode: 0o737 });
|
await Deno.mkdir(path, { mode: 0o737 });
|
||||||
|
@ -58,20 +58,20 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function mkdirErrSyncIfExists() {
|
unitTest({ permissions: { write: true } }, function mkdirErrSyncIfExists() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.mkdirSync(".");
|
Deno.mkdirSync(".");
|
||||||
}, Deno.errors.AlreadyExists);
|
}, Deno.errors.AlreadyExists);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, async function mkdirErrIfExists() {
|
unitTest({ permissions: { write: true } }, async function mkdirErrIfExists() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.mkdir(".");
|
await Deno.mkdir(".");
|
||||||
}, Deno.errors.AlreadyExists);
|
}, Deno.errors.AlreadyExists);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncRecursive() {
|
function mkdirSyncRecursive() {
|
||||||
const path = Deno.makeTempDirSync() + "/nested/directory";
|
const path = Deno.makeTempDirSync() + "/nested/directory";
|
||||||
Deno.mkdirSync(path, { recursive: true });
|
Deno.mkdirSync(path, { recursive: true });
|
||||||
|
@ -80,7 +80,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirRecursive() {
|
async function mkdirRecursive() {
|
||||||
const path = Deno.makeTempDirSync() + "/nested/directory";
|
const path = Deno.makeTempDirSync() + "/nested/directory";
|
||||||
await Deno.mkdir(path, { recursive: true });
|
await Deno.mkdir(path, { recursive: true });
|
||||||
|
@ -89,7 +89,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncRecursiveMode() {
|
function mkdirSyncRecursiveMode() {
|
||||||
const nested = Deno.makeTempDirSync() + "/nested";
|
const nested = Deno.makeTempDirSync() + "/nested";
|
||||||
const path = nested + "/dir";
|
const path = nested + "/dir";
|
||||||
|
@ -100,7 +100,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirRecursiveMode() {
|
async function mkdirRecursiveMode() {
|
||||||
const nested = Deno.makeTempDirSync() + "/nested";
|
const nested = Deno.makeTempDirSync() + "/nested";
|
||||||
const path = nested + "/dir";
|
const path = nested + "/dir";
|
||||||
|
@ -111,7 +111,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncRecursiveIfExists() {
|
function mkdirSyncRecursiveIfExists() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
Deno.mkdirSync(path, { mode: 0o737 });
|
Deno.mkdirSync(path, { mode: 0o737 });
|
||||||
|
@ -129,7 +129,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirRecursiveIfExists() {
|
async function mkdirRecursiveIfExists() {
|
||||||
const path = Deno.makeTempDirSync() + "/dir";
|
const path = Deno.makeTempDirSync() + "/dir";
|
||||||
await Deno.mkdir(path, { mode: 0o737 });
|
await Deno.mkdir(path, { mode: 0o737 });
|
||||||
|
@ -147,7 +147,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncErrors() {
|
function mkdirSyncErrors() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const emptydir = testDir + "/empty";
|
const emptydir = testDir + "/empty";
|
||||||
|
@ -198,7 +198,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function mkdirSyncRelativeUrlPath() {
|
function mkdirSyncRelativeUrlPath() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const nestedDir = testDir + "/nested";
|
const nestedDir = testDir + "/nested";
|
||||||
|
@ -213,7 +213,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function mkdirRelativeUrlPath() {
|
async function mkdirRelativeUrlPath() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const nestedDir = testDir + "/nested";
|
const nestedDir = testDir + "/nested";
|
||||||
|
|
|
@ -17,7 +17,7 @@ try {
|
||||||
isCI = true;
|
isCI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, function netTcpListenClose() {
|
unitTest({ permissions: { net: true } }, function netTcpListenClose() {
|
||||||
const listener = Deno.listen({ hostname: "127.0.0.1", port: 3500 });
|
const listener = Deno.listen({ hostname: "127.0.0.1", port: 3500 });
|
||||||
assert(listener.addr.transport === "tcp");
|
assert(listener.addr.transport === "tcp");
|
||||||
assertEquals(listener.addr.hostname, "127.0.0.1");
|
assertEquals(listener.addr.hostname, "127.0.0.1");
|
||||||
|
@ -28,7 +28,7 @@ unitTest({ perms: { net: true } }, function netTcpListenClose() {
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
function netUdpListenClose() {
|
function netUdpListenClose() {
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
|
@ -44,7 +44,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function netUnixListenClose() {
|
function netUnixListenClose() {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listen({
|
const socket = Deno.listen({
|
||||||
|
@ -58,7 +61,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function netUnixPacketListenClose() {
|
function netUnixPacketListenClose() {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
|
@ -72,7 +78,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
{ ignore: Deno.build.os === "windows", permissions: { read: true } },
|
||||||
function netUnixListenWritePermission() {
|
function netUnixListenWritePermission() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
|
@ -88,7 +94,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
{ ignore: Deno.build.os === "windows", permissions: { read: true } },
|
||||||
function netUnixPacketListenWritePermission() {
|
function netUnixPacketListenWritePermission() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
|
@ -105,7 +111,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function netTcpCloseWhileAccept() {
|
async function netTcpCloseWhileAccept() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
|
@ -122,7 +128,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function netUnixCloseWhileAccept() {
|
async function netUnixCloseWhileAccept() {
|
||||||
const filePath = await Deno.makeTempFile();
|
const filePath = await Deno.makeTempFile();
|
||||||
const listener = Deno.listen({
|
const listener = Deno.listen({
|
||||||
|
@ -142,7 +151,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netTcpConcurrentAccept() {
|
async function netTcpConcurrentAccept() {
|
||||||
const listener = Deno.listen({ port: 4502 });
|
const listener = Deno.listen({ port: 4502 });
|
||||||
let acceptErrCount = 0;
|
let acceptErrCount = 0;
|
||||||
|
@ -166,7 +175,7 @@ unitTest(
|
||||||
|
|
||||||
// TODO(jsouto): Enable when tokio updates mio to v0.7!
|
// TODO(jsouto): Enable when tokio updates mio to v0.7!
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: true, perms: { read: true, write: true } },
|
{ ignore: true, permissions: { read: true, write: true } },
|
||||||
async function netUnixConcurrentAccept() {
|
async function netUnixConcurrentAccept() {
|
||||||
const filePath = await Deno.makeTempFile();
|
const filePath = await Deno.makeTempFile();
|
||||||
const listener = Deno.listen({ transport: "unix", path: filePath });
|
const listener = Deno.listen({ transport: "unix", path: filePath });
|
||||||
|
@ -189,7 +198,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function netTcpDialListen() {
|
unitTest({ permissions: { net: true } }, async function netTcpDialListen() {
|
||||||
const listener = Deno.listen({ port: 3500 });
|
const listener = Deno.listen({ port: 3500 });
|
||||||
listener.accept().then(
|
listener.accept().then(
|
||||||
async (conn) => {
|
async (conn) => {
|
||||||
|
@ -225,7 +234,10 @@ unitTest({ perms: { net: true } }, async function netTcpDialListen() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function netUnixDialListen() {
|
async function netUnixDialListen() {
|
||||||
const filePath = await Deno.makeTempFile();
|
const filePath = await Deno.makeTempFile();
|
||||||
const listener = Deno.listen({ path: filePath, transport: "unix" });
|
const listener = Deno.listen({ path: filePath, transport: "unix" });
|
||||||
|
@ -261,7 +273,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netUdpSendReceive() {
|
async function netUdpSendReceive() {
|
||||||
const alice = Deno.listenDatagram({ port: 3500, transport: "udp" });
|
const alice = Deno.listenDatagram({ port: 3500, transport: "udp" });
|
||||||
assert(alice.addr.transport === "udp");
|
assert(alice.addr.transport === "udp");
|
||||||
|
@ -291,7 +303,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netUdpConcurrentSendReceive() {
|
async function netUdpConcurrentSendReceive() {
|
||||||
const socket = Deno.listenDatagram({ port: 3500, transport: "udp" });
|
const socket = Deno.listenDatagram({ port: 3500, transport: "udp" });
|
||||||
assert(socket.addr.transport === "udp");
|
assert(socket.addr.transport === "udp");
|
||||||
|
@ -315,7 +327,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netUdpBorrowMutError() {
|
async function netUdpBorrowMutError() {
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
port: 4501,
|
port: 4501,
|
||||||
|
@ -330,7 +342,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function netUnixPacketSendReceive() {
|
async function netUnixPacketSendReceive() {
|
||||||
const filePath = await Deno.makeTempFile();
|
const filePath = await Deno.makeTempFile();
|
||||||
const alice = Deno.listenDatagram({
|
const alice = Deno.listenDatagram({
|
||||||
|
@ -365,7 +380,7 @@ unitTest(
|
||||||
|
|
||||||
// TODO(piscisaureus): Enable after Tokio v0.3/v1.0 upgrade.
|
// TODO(piscisaureus): Enable after Tokio v0.3/v1.0 upgrade.
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: true, perms: { read: true, write: true } },
|
{ ignore: true, permissions: { read: true, write: true } },
|
||||||
async function netUnixPacketConcurrentSendReceive() {
|
async function netUnixPacketConcurrentSendReceive() {
|
||||||
const filePath = await Deno.makeTempFile();
|
const filePath = await Deno.makeTempFile();
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
|
@ -392,7 +407,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netTcpListenIteratorBreakClosesResource() {
|
async function netTcpListenIteratorBreakClosesResource() {
|
||||||
async function iterate(listener: Deno.Listener) {
|
async function iterate(listener: Deno.Listener) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
@ -422,7 +437,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netTcpListenCloseWhileIterating() {
|
async function netTcpListenCloseWhileIterating() {
|
||||||
const listener = Deno.listen({ port: 8001 });
|
const listener = Deno.listen({ port: 8001 });
|
||||||
const nextWhileClosing = listener[Symbol.asyncIterator]().next();
|
const nextWhileClosing = listener[Symbol.asyncIterator]().next();
|
||||||
|
@ -435,7 +450,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function netUdpListenCloseWhileIterating() {
|
async function netUdpListenCloseWhileIterating() {
|
||||||
const socket = Deno.listenDatagram({ port: 8000, transport: "udp" });
|
const socket = Deno.listenDatagram({ port: 8000, transport: "udp" });
|
||||||
const nextWhileClosing = socket[Symbol.asyncIterator]().next();
|
const nextWhileClosing = socket[Symbol.asyncIterator]().next();
|
||||||
|
@ -448,7 +463,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function netUnixListenCloseWhileIterating() {
|
async function netUnixListenCloseWhileIterating() {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listen({ path: filePath, transport: "unix" });
|
const socket = Deno.listen({ path: filePath, transport: "unix" });
|
||||||
|
@ -462,7 +480,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
async function netUnixPacketListenCloseWhileIterating() {
|
async function netUnixPacketListenCloseWhileIterating() {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
|
@ -482,7 +503,7 @@ unitTest(
|
||||||
{
|
{
|
||||||
// FIXME(bartlomieju)
|
// FIXME(bartlomieju)
|
||||||
ignore: true,
|
ignore: true,
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function netListenAsyncIterator() {
|
async function netListenAsyncIterator() {
|
||||||
const addr = { hostname: "127.0.0.1", port: 3500 };
|
const addr = { hostname: "127.0.0.1", port: 3500 };
|
||||||
|
@ -515,7 +536,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function netCloseWriteSuccess() {
|
async function netCloseWriteSuccess() {
|
||||||
const addr = { hostname: "127.0.0.1", port: 3500 };
|
const addr = { hostname: "127.0.0.1", port: 3500 };
|
||||||
|
@ -550,7 +571,7 @@ unitTest(
|
||||||
{
|
{
|
||||||
// https://github.com/denoland/deno/issues/11580
|
// https://github.com/denoland/deno/issues/11580
|
||||||
ignore: Deno.build.os === "darwin" && isCI,
|
ignore: Deno.build.os === "darwin" && isCI,
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
async function netHangsOnClose() {
|
async function netHangsOnClose() {
|
||||||
let acceptedConn: Deno.Conn;
|
let acceptedConn: Deno.Conn;
|
||||||
|
@ -596,7 +617,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { net: true },
|
permissions: { net: true },
|
||||||
},
|
},
|
||||||
function netExplicitUndefinedHostname() {
|
function netExplicitUndefinedHostname() {
|
||||||
const listener = Deno.listen({ hostname: undefined, port: 8080 });
|
const listener = Deno.listen({ hostname: undefined, port: 8080 });
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function envSuccess() {
|
unitTest({ permissions: { env: true } }, function envSuccess() {
|
||||||
Deno.env.set("TEST_VAR", "A");
|
Deno.env.set("TEST_VAR", "A");
|
||||||
const env = Deno.env.toObject();
|
const env = Deno.env.toObject();
|
||||||
Deno.env.set("TEST_VAR", "B");
|
Deno.env.set("TEST_VAR", "B");
|
||||||
|
@ -15,19 +15,19 @@ unitTest({ perms: { env: true } }, function envSuccess() {
|
||||||
assertNotEquals(Deno.env.get("TEST_VAR"), env["TEST_VAR"]);
|
assertNotEquals(Deno.env.get("TEST_VAR"), env["TEST_VAR"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function envNotFound() {
|
unitTest({ permissions: { env: true } }, function envNotFound() {
|
||||||
const r = Deno.env.get("env_var_does_not_exist!");
|
const r = Deno.env.get("env_var_does_not_exist!");
|
||||||
assertEquals(r, undefined);
|
assertEquals(r, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function deleteEnv() {
|
unitTest({ permissions: { env: true } }, function deleteEnv() {
|
||||||
Deno.env.set("TEST_VAR", "A");
|
Deno.env.set("TEST_VAR", "A");
|
||||||
assertEquals(Deno.env.get("TEST_VAR"), "A");
|
assertEquals(Deno.env.get("TEST_VAR"), "A");
|
||||||
assertEquals(Deno.env.delete("TEST_VAR"), undefined);
|
assertEquals(Deno.env.delete("TEST_VAR"), undefined);
|
||||||
assertEquals(Deno.env.get("TEST_VAR"), undefined);
|
assertEquals(Deno.env.get("TEST_VAR"), undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function avoidEmptyNamedEnv() {
|
unitTest({ permissions: { env: true } }, function avoidEmptyNamedEnv() {
|
||||||
assertThrows(() => Deno.env.set("", "v"), TypeError);
|
assertThrows(() => Deno.env.set("", "v"), TypeError);
|
||||||
assertThrows(() => Deno.env.set("a=a", "v"), TypeError);
|
assertThrows(() => Deno.env.set("a=a", "v"), TypeError);
|
||||||
assertThrows(() => Deno.env.set("a\0a", "v"), TypeError);
|
assertThrows(() => Deno.env.set("a\0a", "v"), TypeError);
|
||||||
|
@ -60,7 +60,7 @@ unitTest(function envPermissionDenied2() {
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
ignore: Deno.build.os !== "windows",
|
ignore: Deno.build.os !== "windows",
|
||||||
perms: { read: true, env: true, run: true },
|
permissions: { read: true, env: true, run: true },
|
||||||
},
|
},
|
||||||
async function envCaseInsensitive() {
|
async function envCaseInsensitive() {
|
||||||
// Utility function that runs a Deno subprocess with the environment
|
// Utility function that runs a Deno subprocess with the environment
|
||||||
|
@ -131,7 +131,7 @@ unitTest(function osPpid() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function osPpidIsEqualToPidOfParentProcess() {
|
async function osPpidIsEqualToPidOfParentProcess() {
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
const process = Deno.run({
|
const process = Deno.run({
|
||||||
|
@ -148,11 +148,11 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function execPath() {
|
unitTest({ permissions: { read: true } }, function execPath() {
|
||||||
assertNotEquals(Deno.execPath(), "");
|
assertNotEquals(Deno.execPath(), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function execPathPerm() {
|
unitTest({ permissions: { read: false } }, function execPathPerm() {
|
||||||
assertThrows(
|
assertThrows(
|
||||||
() => {
|
() => {
|
||||||
Deno.execPath();
|
Deno.execPath();
|
||||||
|
@ -162,38 +162,38 @@ unitTest({ perms: { read: false } }, function execPathPerm() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function loadavgSuccess() {
|
unitTest({ permissions: { env: true } }, function loadavgSuccess() {
|
||||||
const load = Deno.loadavg();
|
const load = Deno.loadavg();
|
||||||
assertEquals(load.length, 3);
|
assertEquals(load.length, 3);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: false } }, function loadavgPerm() {
|
unitTest({ permissions: { env: false } }, function loadavgPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.loadavg();
|
Deno.loadavg();
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function hostnameDir() {
|
unitTest({ permissions: { env: true } }, function hostnameDir() {
|
||||||
assertNotEquals(Deno.hostname(), "");
|
assertNotEquals(Deno.hostname(), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: false } }, function hostnamePerm() {
|
unitTest({ permissions: { env: false } }, function hostnamePerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.hostname();
|
Deno.hostname();
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function releaseDir() {
|
unitTest({ permissions: { env: true } }, function releaseDir() {
|
||||||
assertNotEquals(Deno.osRelease(), "");
|
assertNotEquals(Deno.osRelease(), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: false } }, function releasePerm() {
|
unitTest({ permissions: { env: false } }, function releasePerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.osRelease();
|
Deno.osRelease();
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { env: true } }, function systemMemoryInfo() {
|
unitTest({ permissions: { env: true } }, function systemMemoryInfo() {
|
||||||
const info = Deno.systemMemoryInfo();
|
const info = Deno.systemMemoryInfo();
|
||||||
assert(info.total >= 0);
|
assert(info.total >= 0);
|
||||||
assert(info.free >= 0);
|
assert(info.free >= 0);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { hrtime: false } }, async function performanceNow() {
|
unitTest({ permissions: { hrtime: false } }, async function performanceNow() {
|
||||||
const resolvable = deferred();
|
const resolvable = deferred();
|
||||||
const start = performance.now();
|
const start = performance.now();
|
||||||
let totalTime = 0;
|
let totalTime = 0;
|
||||||
|
|
|
@ -7,14 +7,14 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function runPermissions() {
|
unitTest({ permissions: { read: true } }, function runPermissions() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.run({ cmd: [Deno.execPath(), "eval", "console.log('hello world')"] });
|
Deno.run({ cmd: [Deno.execPath(), "eval", "console.log('hello world')"] });
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runSuccess() {
|
async function runSuccess() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
|
cmd: [Deno.execPath(), "eval", "console.log('hello world')"],
|
||||||
|
@ -31,7 +31,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runUrl() {
|
async function runUrl() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -52,7 +52,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runStdinRid0(): Promise<
|
async function runStdinRid0(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -72,7 +72,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
function runInvalidStdio() {
|
function runInvalidStdio() {
|
||||||
assertThrows(() =>
|
assertThrows(() =>
|
||||||
Deno.run({
|
Deno.run({
|
||||||
|
@ -99,7 +99,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runCommandFailedWithCode() {
|
async function runCommandFailedWithCode() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"],
|
cmd: [Deno.execPath(), "eval", "Deno.exit(41 + 1)"],
|
||||||
|
@ -116,7 +116,7 @@ unitTest(
|
||||||
{
|
{
|
||||||
// No signals on windows.
|
// No signals on windows.
|
||||||
ignore: Deno.build.os === "windows",
|
ignore: Deno.build.os === "windows",
|
||||||
perms: { run: true, read: true },
|
permissions: { run: true, read: true },
|
||||||
},
|
},
|
||||||
async function runCommandFailedWithSignal() {
|
async function runCommandFailedWithSignal() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
|
@ -135,7 +135,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { run: true } }, function runNotFound() {
|
unitTest({ permissions: { run: true } }, function runNotFound() {
|
||||||
let error;
|
let error;
|
||||||
try {
|
try {
|
||||||
Deno.run({ cmd: ["this file hopefully doesn't exist"] });
|
Deno.run({ cmd: ["this file hopefully doesn't exist"] });
|
||||||
|
@ -147,7 +147,7 @@ unitTest({ perms: { run: true } }, function runNotFound() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, run: true, read: true } },
|
{ permissions: { write: true, run: true, read: true } },
|
||||||
async function runWithCwdIsAsync() {
|
async function runWithCwdIsAsync() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const cwd = await Deno.makeTempDir({ prefix: "deno_command_test" });
|
const cwd = await Deno.makeTempDir({ prefix: "deno_command_test" });
|
||||||
|
@ -188,7 +188,7 @@ tryExit();
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runStdinPiped(): Promise<
|
async function runStdinPiped(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -219,7 +219,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runStdoutPiped(): Promise<
|
async function runStdoutPiped(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -255,7 +255,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runStderrPiped(): Promise<
|
async function runStderrPiped(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -291,7 +291,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runOutput() {
|
async function runOutput() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -309,7 +309,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runStderrOutput(): Promise<
|
async function runStderrOutput(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -329,7 +329,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true, read: true } },
|
{ permissions: { run: true, write: true, read: true } },
|
||||||
async function runRedirectStdoutStderr() {
|
async function runRedirectStdoutStderr() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const fileName = tempDir + "/redirected_stdio.txt";
|
const fileName = tempDir + "/redirected_stdio.txt";
|
||||||
|
@ -362,7 +362,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true, read: true } },
|
{ permissions: { run: true, write: true, read: true } },
|
||||||
async function runRedirectStdin() {
|
async function runRedirectStdin() {
|
||||||
const tempDir = await Deno.makeTempDir();
|
const tempDir = await Deno.makeTempDir();
|
||||||
const fileName = tempDir + "/redirected_stdio.txt";
|
const fileName = tempDir + "/redirected_stdio.txt";
|
||||||
|
@ -387,7 +387,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runEnv() {
|
async function runEnv() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -409,7 +409,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runClose() {
|
async function runClose() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -432,7 +432,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function runKillAfterStatus() {
|
async function runKillAfterStatus() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [Deno.execPath(), "eval", 'console.log("hello")'],
|
cmd: [Deno.execPath(), "eval", 'console.log("hello")'],
|
||||||
|
@ -468,7 +468,7 @@ unitTest(function killPermissions() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true } },
|
{ permissions: { run: true, read: true } },
|
||||||
async function killSuccess() {
|
async function killSuccess() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
|
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
|
||||||
|
@ -494,7 +494,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { run: true, read: true } }, function killFailed() {
|
unitTest({ permissions: { run: true, read: true } }, function killFailed() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
|
cmd: [Deno.execPath(), "eval", "setTimeout(() => {}, 10000)"],
|
||||||
});
|
});
|
||||||
|
@ -511,7 +511,7 @@ unitTest({ perms: { run: true, read: true } }, function killFailed() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true, env: true } },
|
{ permissions: { run: true, read: true, env: true } },
|
||||||
async function clearEnv(): Promise<void> {
|
async function clearEnv(): Promise<void> {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -539,7 +539,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true }, ignore: Deno.build.os === "windows" },
|
{
|
||||||
|
permissions: { run: true, read: true },
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
},
|
||||||
async function uid(): Promise<void> {
|
async function uid(): Promise<void> {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -567,7 +570,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, read: true }, ignore: Deno.build.os === "windows" },
|
{
|
||||||
|
permissions: { run: true, read: true },
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
},
|
||||||
async function gid(): Promise<void> {
|
async function gid(): Promise<void> {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
|
|
@ -21,37 +21,37 @@ function assertSameContent(files: Deno.DirEntry[]) {
|
||||||
assertEquals(counter, 1);
|
assertEquals(counter, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readDirSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function readDirSyncSuccess() {
|
||||||
const files = [...Deno.readDirSync("cli/tests/testdata")];
|
const files = [...Deno.readDirSync("cli/tests/testdata")];
|
||||||
assertSameContent(files);
|
assertSameContent(files);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readDirSyncWithUrl() {
|
unitTest({ permissions: { read: true } }, function readDirSyncWithUrl() {
|
||||||
const files = [
|
const files = [
|
||||||
...Deno.readDirSync(pathToAbsoluteFileUrl("cli/tests/testdata")),
|
...Deno.readDirSync(pathToAbsoluteFileUrl("cli/tests/testdata")),
|
||||||
];
|
];
|
||||||
assertSameContent(files);
|
assertSameContent(files);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function readDirSyncPerm() {
|
unitTest({ permissions: { read: false } }, function readDirSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readDirSync("tests/");
|
Deno.readDirSync("tests/");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readDirSyncNotDir() {
|
unitTest({ permissions: { read: true } }, function readDirSyncNotDir() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readDirSync("cli/tests/testdata/fixture.json");
|
Deno.readDirSync("cli/tests/testdata/fixture.json");
|
||||||
}, Error);
|
}, Error);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readDirSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function readDirSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readDirSync("bad_dir_name");
|
Deno.readDirSync("bad_dir_name");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function readDirSuccess() {
|
unitTest({ permissions: { read: true } }, async function readDirSuccess() {
|
||||||
const files = [];
|
const files = [];
|
||||||
for await (const dirEntry of Deno.readDir("cli/tests/testdata")) {
|
for await (const dirEntry of Deno.readDir("cli/tests/testdata")) {
|
||||||
files.push(dirEntry);
|
files.push(dirEntry);
|
||||||
|
@ -59,7 +59,7 @@ unitTest({ perms: { read: true } }, async function readDirSuccess() {
|
||||||
assertSameContent(files);
|
assertSameContent(files);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function readDirWithUrl() {
|
unitTest({ permissions: { read: true } }, async function readDirWithUrl() {
|
||||||
const files = [];
|
const files = [];
|
||||||
for await (
|
for await (
|
||||||
const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests/testdata"))
|
const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests/testdata"))
|
||||||
|
@ -69,14 +69,14 @@ unitTest({ perms: { read: true } }, async function readDirWithUrl() {
|
||||||
assertSameContent(files);
|
assertSameContent(files);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function readDirPerm() {
|
unitTest({ permissions: { read: false } }, async function readDirPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.readDir("tests/")[Symbol.asyncIterator]().next();
|
await Deno.readDir("tests/")[Symbol.asyncIterator]().next();
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true }, ignore: Deno.build.os == "windows" },
|
{ permissions: { read: true }, ignore: Deno.build.os == "windows" },
|
||||||
async function readDirDevFd(): Promise<
|
async function readDirDevFd(): Promise<
|
||||||
void
|
void
|
||||||
> {
|
> {
|
||||||
|
@ -87,7 +87,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true }, ignore: Deno.build.os == "windows" },
|
{ permissions: { read: true }, ignore: Deno.build.os == "windows" },
|
||||||
function readDirDevFdSync() {
|
function readDirDevFdSync() {
|
||||||
for (const _ of Deno.readDirSync("/dev/fd")) {
|
for (const _ of Deno.readDirSync("/dev/fd")) {
|
||||||
// We don't actually care whats in here; just that we don't panic on non regular file entries
|
// We don't actually care whats in here; just that we don't panic on non regular file entries
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readFileSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function readFileSyncSuccess() {
|
||||||
const data = Deno.readFileSync("cli/tests/testdata/fixture.json");
|
const data = Deno.readFileSync("cli/tests/testdata/fixture.json");
|
||||||
assert(data.byteLength > 0);
|
assert(data.byteLength > 0);
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
|
@ -17,7 +17,7 @@ unitTest({ perms: { read: true } }, function readFileSyncSuccess() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readFileSyncUrl() {
|
unitTest({ permissions: { read: true } }, function readFileSyncUrl() {
|
||||||
const data = Deno.readFileSync(
|
const data = Deno.readFileSync(
|
||||||
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
||||||
);
|
);
|
||||||
|
@ -28,19 +28,19 @@ unitTest({ perms: { read: true } }, function readFileSyncUrl() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function readFileSyncPerm() {
|
unitTest({ permissions: { read: false } }, function readFileSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readFileSync("cli/tests/testdata/fixture.json");
|
Deno.readFileSync("cli/tests/testdata/fixture.json");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readFileSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function readFileSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readFileSync("bad_filename");
|
Deno.readFileSync("bad_filename");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function readFileUrl() {
|
unitTest({ permissions: { read: true } }, async function readFileUrl() {
|
||||||
const data = await Deno.readFile(
|
const data = await Deno.readFile(
|
||||||
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
||||||
);
|
);
|
||||||
|
@ -51,7 +51,7 @@ unitTest({ perms: { read: true } }, async function readFileUrl() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function readFileSuccess() {
|
unitTest({ permissions: { read: true } }, async function readFileSuccess() {
|
||||||
const data = await Deno.readFile("cli/tests/testdata/fixture.json");
|
const data = await Deno.readFile("cli/tests/testdata/fixture.json");
|
||||||
assert(data.byteLength > 0);
|
assert(data.byteLength > 0);
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
|
@ -60,20 +60,20 @@ unitTest({ perms: { read: true } }, async function readFileSuccess() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function readFilePerm() {
|
unitTest({ permissions: { read: false } }, async function readFilePerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.readFile("cli/tests/testdata/fixture.json");
|
await Deno.readFile("cli/tests/testdata/fixture.json");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readFileSyncLoop() {
|
unitTest({ permissions: { read: true } }, function readFileSyncLoop() {
|
||||||
for (let i = 0; i < 256; i++) {
|
for (let i = 0; i < 256; i++) {
|
||||||
Deno.readFileSync("cli/tests/testdata/fixture.json");
|
Deno.readFileSync("cli/tests/testdata/fixture.json");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function readFileDoesNotLeakResources() {
|
async function readFileDoesNotLeakResources() {
|
||||||
const resourcesBefore = Deno.resources();
|
const resourcesBefore = Deno.resources();
|
||||||
await assertRejects(async () => await Deno.readFile("cli"));
|
await assertRejects(async () => await Deno.readFile("cli"));
|
||||||
|
@ -82,7 +82,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
function readFileSyncDoesNotLeakResources() {
|
function readFileSyncDoesNotLeakResources() {
|
||||||
const resourcesBefore = Deno.resources();
|
const resourcesBefore = Deno.resources();
|
||||||
assertThrows(() => Deno.readFileSync("cli"));
|
assertThrows(() => Deno.readFileSync("cli"));
|
||||||
|
@ -91,7 +91,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function readFileWithAbortSignal() {
|
async function readFileWithAbortSignal() {
|
||||||
const ac = new AbortController();
|
const ac = new AbortController();
|
||||||
queueMicrotask(() => ac.abort());
|
queueMicrotask(() => ac.abort());
|
||||||
|
@ -104,7 +104,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function readTextileWithAbortSignal() {
|
async function readTextileWithAbortSignal() {
|
||||||
const ac = new AbortController();
|
const ac = new AbortController();
|
||||||
queueMicrotask(() => ac.abort());
|
queueMicrotask(() => ac.abort());
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
function readLinkSyncSuccess() {
|
function readLinkSyncSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir +
|
const target = testDir +
|
||||||
|
@ -23,7 +23,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
function readLinkSyncUrlSuccess() {
|
function readLinkSyncUrlSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir +
|
const target = testDir +
|
||||||
|
@ -37,20 +37,20 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function readLinkSyncPerm() {
|
unitTest({ permissions: { read: false } }, function readLinkSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readLinkSync("/symlink");
|
Deno.readLinkSync("/symlink");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readLinkSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function readLinkSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readLinkSync("bad_filename");
|
Deno.readLinkSync("bad_filename");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function readLinkSuccess() {
|
async function readLinkSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir +
|
const target = testDir +
|
||||||
|
@ -65,7 +65,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function readLinkUrlSuccess() {
|
async function readLinkUrlSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const target = testDir +
|
const target = testDir +
|
||||||
|
@ -79,7 +79,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function readLinkPerm() {
|
unitTest({ permissions: { read: false } }, async function readLinkPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.readLink("/symlink");
|
await Deno.readLink("/symlink");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
|
|
|
@ -7,14 +7,14 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readTextFileSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function readTextFileSyncSuccess() {
|
||||||
const data = Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
const data = Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
||||||
assert(data.length > 0);
|
assert(data.length > 0);
|
||||||
const pkg = JSON.parse(data);
|
const pkg = JSON.parse(data);
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readTextFileSyncByUrl() {
|
unitTest({ permissions: { read: true } }, function readTextFileSyncByUrl() {
|
||||||
const data = Deno.readTextFileSync(
|
const data = Deno.readTextFileSync(
|
||||||
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
||||||
);
|
);
|
||||||
|
@ -23,20 +23,20 @@ unitTest({ perms: { read: true } }, function readTextFileSyncByUrl() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function readTextFileSyncPerm() {
|
unitTest({ permissions: { read: false } }, function readTextFileSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readTextFileSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function readTextFileSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.readTextFileSync("bad_filename");
|
Deno.readTextFileSync("bad_filename");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function readTextFileSuccess() {
|
async function readTextFileSuccess() {
|
||||||
const data = await Deno.readTextFile("cli/tests/testdata/fixture.json");
|
const data = await Deno.readTextFile("cli/tests/testdata/fixture.json");
|
||||||
assert(data.length > 0);
|
assert(data.length > 0);
|
||||||
|
@ -45,7 +45,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function readTextFileByUrl() {
|
unitTest({ permissions: { read: true } }, async function readTextFileByUrl() {
|
||||||
const data = await Deno.readTextFile(
|
const data = await Deno.readTextFile(
|
||||||
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"),
|
||||||
);
|
);
|
||||||
|
@ -54,20 +54,20 @@ unitTest({ perms: { read: true } }, async function readTextFileByUrl() {
|
||||||
assertEquals(pkg.name, "deno");
|
assertEquals(pkg.name, "deno");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function readTextFilePerm() {
|
unitTest({ permissions: { read: false } }, async function readTextFilePerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.readTextFile("cli/tests/testdata/fixture.json");
|
await Deno.readTextFile("cli/tests/testdata/fixture.json");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function readTextFileSyncLoop() {
|
unitTest({ permissions: { read: true } }, function readTextFileSyncLoop() {
|
||||||
for (let i = 0; i < 256; i++) {
|
for (let i = 0; i < 256; i++) {
|
||||||
Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
Deno.readTextFileSync("cli/tests/testdata/fixture.json");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function readTextFileDoesNotLeakResources() {
|
async function readTextFileDoesNotLeakResources() {
|
||||||
const resourcesBefore = Deno.resources();
|
const resourcesBefore = Deno.resources();
|
||||||
await assertRejects(async () => await Deno.readTextFile("cli"));
|
await assertRejects(async () => await Deno.readTextFile("cli"));
|
||||||
|
@ -76,7 +76,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
function readTextFileSyncDoesNotLeakResources() {
|
function readTextFileSyncDoesNotLeakResources() {
|
||||||
const resourcesBefore = Deno.resources();
|
const resourcesBefore = Deno.resources();
|
||||||
assertThrows(() => Deno.readTextFileSync("cli"));
|
assertThrows(() => Deno.readTextFileSync("cli"));
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function realPathSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function realPathSyncSuccess() {
|
||||||
const relative = "cli/tests/testdata/fixture.json";
|
const relative = "cli/tests/testdata/fixture.json";
|
||||||
const realPath = Deno.realPathSync(relative);
|
const realPath = Deno.realPathSync(relative);
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
|
@ -21,7 +21,7 @@ unitTest({ perms: { read: true } }, function realPathSyncSuccess() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function realPathSyncUrl() {
|
unitTest({ permissions: { read: true } }, function realPathSyncUrl() {
|
||||||
const relative = "cli/tests/testdata/fixture.json";
|
const relative = "cli/tests/testdata/fixture.json";
|
||||||
const url = pathToAbsoluteFileUrl(relative);
|
const url = pathToAbsoluteFileUrl(relative);
|
||||||
assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url));
|
assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url));
|
||||||
|
@ -29,7 +29,7 @@ unitTest({ perms: { read: true } }, function realPathSyncUrl() {
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
function realPathSyncSymlink() {
|
function realPathSyncSymlink() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
@ -48,19 +48,19 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function realPathSyncPerm() {
|
unitTest({ permissions: { read: false } }, function realPathSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.realPathSync("some_file");
|
Deno.realPathSync("some_file");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function realPathSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function realPathSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.realPathSync("bad_filename");
|
Deno.realPathSync("bad_filename");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function realPathSuccess() {
|
unitTest({ permissions: { read: true } }, async function realPathSuccess() {
|
||||||
const relativePath = "cli/tests/testdata/fixture.json";
|
const relativePath = "cli/tests/testdata/fixture.json";
|
||||||
const realPath = await Deno.realPath(relativePath);
|
const realPath = await Deno.realPath(relativePath);
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
|
@ -73,7 +73,7 @@ unitTest({ perms: { read: true } }, async function realPathSuccess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
async function realPathUrl() {
|
async function realPathUrl() {
|
||||||
const relative = "cli/tests/testdata/fixture.json";
|
const relative = "cli/tests/testdata/fixture.json";
|
||||||
const url = pathToAbsoluteFileUrl(relative);
|
const url = pathToAbsoluteFileUrl(relative);
|
||||||
|
@ -83,7 +83,7 @@ unitTest(
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true },
|
permissions: { read: true, write: true },
|
||||||
},
|
},
|
||||||
async function realPathSymlink() {
|
async function realPathSymlink() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
@ -102,13 +102,13 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function realPathPerm() {
|
unitTest({ permissions: { read: false } }, async function realPathPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.realPath("some_file");
|
await Deno.realPath("some_file");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function realPathNotFound() {
|
unitTest({ permissions: { read: true } }, async function realPathNotFound() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.realPath("bad_filename");
|
await Deno.realPath("bad_filename");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { assert, assertRejects, assertThrows, unitTest } from "./test_util.ts";
|
||||||
const REMOVE_METHODS = ["remove", "removeSync"] as const;
|
const REMOVE_METHODS = ["remove", "removeSync"] as const;
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeDirSuccess() {
|
async function removeDirSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// REMOVE EMPTY DIRECTORY
|
// REMOVE EMPTY DIRECTORY
|
||||||
|
@ -22,7 +22,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeFileSuccess() {
|
async function removeFileSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// REMOVE FILE
|
// REMOVE FILE
|
||||||
|
@ -42,7 +42,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeFileByUrl() {
|
async function removeFileByUrl() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// REMOVE FILE
|
// REMOVE FILE
|
||||||
|
@ -67,7 +67,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeFail() {
|
async function removeFail() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// NON-EMPTY DIRECTORY
|
// NON-EMPTY DIRECTORY
|
||||||
|
@ -94,7 +94,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeDanglingSymlinkSuccess() {
|
async function removeDanglingSymlinkSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink";
|
const danglingSymlinkPath = Deno.makeTempDirSync() + "/dangling_symlink";
|
||||||
|
@ -116,7 +116,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeValidSymlinkSuccess() {
|
async function removeValidSymlinkSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
@ -141,7 +141,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, async function removePerm() {
|
unitTest({ permissions: { write: false } }, async function removePerm() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno[method]("/baddir");
|
await Deno[method]("/baddir");
|
||||||
|
@ -150,7 +150,7 @@ unitTest({ perms: { write: false } }, async function removePerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeAllDirSuccess() {
|
async function removeAllDirSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// REMOVE EMPTY DIRECTORY
|
// REMOVE EMPTY DIRECTORY
|
||||||
|
@ -187,7 +187,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: true, read: true } },
|
{ permissions: { write: true, read: true } },
|
||||||
async function removeAllFileSuccess() {
|
async function removeAllFileSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// REMOVE FILE
|
// REMOVE FILE
|
||||||
|
@ -207,7 +207,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, async function removeAllFail() {
|
unitTest({ permissions: { write: true } }, async function removeAllFail() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
// NON-EXISTENT DIRECTORY/FILE
|
// NON-EXISTENT DIRECTORY/FILE
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
|
@ -217,7 +217,7 @@ unitTest({ perms: { write: true } }, async function removeAllFail() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, async function removeAllPerm() {
|
unitTest({ permissions: { write: false } }, async function removeAllPerm() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno[method]("/baddir", { recursive: true });
|
await Deno[method]("/baddir", { recursive: true });
|
||||||
|
@ -228,7 +228,7 @@ unitTest({ perms: { write: false } }, async function removeAllPerm() {
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
ignore: Deno.build.os === "windows",
|
ignore: Deno.build.os === "windows",
|
||||||
perms: { write: true, read: true },
|
permissions: { write: true, read: true },
|
||||||
},
|
},
|
||||||
async function removeUnixSocketSuccess() {
|
async function removeUnixSocketSuccess() {
|
||||||
for (const method of REMOVE_METHODS) {
|
for (const method of REMOVE_METHODS) {
|
||||||
|
@ -248,7 +248,7 @@ unitTest(
|
||||||
|
|
||||||
if (Deno.build.os === "windows") {
|
if (Deno.build.os === "windows") {
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true, read: true } },
|
{ permissions: { run: true, write: true, read: true } },
|
||||||
async function removeFileSymlink() {
|
async function removeFileSymlink() {
|
||||||
const symlink = Deno.run({
|
const symlink = Deno.run({
|
||||||
cmd: ["cmd", "/c", "mklink", "file_link", "bar"],
|
cmd: ["cmd", "/c", "mklink", "file_link", "bar"],
|
||||||
|
@ -265,7 +265,7 @@ if (Deno.build.os === "windows") {
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { run: true, write: true, read: true } },
|
{ permissions: { run: true, write: true, read: true } },
|
||||||
async function removeDirSymlink() {
|
async function removeDirSymlink() {
|
||||||
const symlink = Deno.run({
|
const symlink = Deno.run({
|
||||||
cmd: ["cmd", "/c", "mklink", "/d", "dir_link", "bar"],
|
cmd: ["cmd", "/c", "mklink", "/d", "dir_link", "bar"],
|
||||||
|
|
|
@ -34,7 +34,7 @@ function assertDirectory(path: string, mode?: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function renameSyncSuccess() {
|
function renameSyncSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldpath = testDir + "/oldpath";
|
const oldpath = testDir + "/oldpath";
|
||||||
|
@ -47,7 +47,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function renameSyncWithURL() {
|
function renameSyncWithURL() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldpath = testDir + "/oldpath";
|
const oldpath = testDir + "/oldpath";
|
||||||
|
@ -63,7 +63,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: false, write: true } },
|
{ permissions: { read: false, write: true } },
|
||||||
function renameSyncReadPerm() {
|
function renameSyncReadPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
const oldpath = "/oldbaddir";
|
const oldpath = "/oldbaddir";
|
||||||
|
@ -74,7 +74,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
function renameSyncWritePerm() {
|
function renameSyncWritePerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
const oldpath = "/oldbaddir";
|
const oldpath = "/oldbaddir";
|
||||||
|
@ -85,7 +85,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function renameSuccess() {
|
async function renameSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldpath = testDir + "/oldpath";
|
const oldpath = testDir + "/oldpath";
|
||||||
|
@ -98,7 +98,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function renameWithURL() {
|
async function renameWithURL() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldpath = testDir + "/oldpath";
|
const oldpath = testDir + "/oldpath";
|
||||||
|
@ -126,7 +126,10 @@ function writeFileString(filename: string, s: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function renameSyncErrorsUnix() {
|
function renameSyncErrorsUnix() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldfile = testDir + "/oldfile";
|
const oldfile = testDir + "/oldfile";
|
||||||
|
@ -201,7 +204,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os !== "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os !== "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function renameSyncErrorsWin() {
|
function renameSyncErrorsWin() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldfile = testDir + "/oldfile";
|
const oldfile = testDir + "/oldfile";
|
||||||
|
|
|
@ -15,7 +15,7 @@ unitTest(function resourcesStdio() {
|
||||||
assertEquals(res[2], "stderr");
|
assertEquals(res[2], "stderr");
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, async function resourcesNet() {
|
unitTest({ permissions: { net: true } }, async function resourcesNet() {
|
||||||
const listener = Deno.listen({ port: 4501 });
|
const listener = Deno.listen({ port: 4501 });
|
||||||
const dialerConn = await Deno.connect({ port: 4501 });
|
const dialerConn = await Deno.connect({ port: 4501 });
|
||||||
const listenerConn = await listener.accept();
|
const listenerConn = await listener.accept();
|
||||||
|
@ -35,7 +35,7 @@ unitTest({ perms: { net: true } }, async function resourcesNet() {
|
||||||
listener.close();
|
listener.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function resourcesFile() {
|
unitTest({ permissions: { read: true } }, async function resourcesFile() {
|
||||||
const resourcesBefore = Deno.resources();
|
const resourcesBefore = Deno.resources();
|
||||||
const f = await Deno.open("cli/tests/testdata/hello.txt");
|
const f = await Deno.open("cli/tests/testdata/hello.txt");
|
||||||
const resourcesAfter = Deno.resources();
|
const resourcesAfter = Deno.resources();
|
||||||
|
|
|
@ -99,7 +99,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { run: true, net: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { run: true, net: true },
|
||||||
|
},
|
||||||
async function signalStreamTest() {
|
async function signalStreamTest() {
|
||||||
const resolvable = deferred();
|
const resolvable = deferred();
|
||||||
// This prevents the program from exiting.
|
// This prevents the program from exiting.
|
||||||
|
@ -131,7 +134,10 @@ unitTest(
|
||||||
|
|
||||||
// This tests that pending op_signal_poll doesn't block the runtime from exiting the process.
|
// This tests that pending op_signal_poll doesn't block the runtime from exiting the process.
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { run: true, read: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { run: true, read: true },
|
||||||
|
},
|
||||||
async function signalStreamExitTest() {
|
async function signalStreamExitTest() {
|
||||||
const p = Deno.run({
|
const p = Deno.run({
|
||||||
cmd: [
|
cmd: [
|
||||||
|
@ -148,7 +154,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { run: true } },
|
{ ignore: Deno.build.os === "windows", permissions: { run: true } },
|
||||||
async function signalPromiseTest() {
|
async function signalPromiseTest() {
|
||||||
const resolvable = deferred();
|
const resolvable = deferred();
|
||||||
// This prevents the program from exiting.
|
// This prevents the program from exiting.
|
||||||
|
@ -169,7 +175,7 @@ unitTest(
|
||||||
|
|
||||||
// https://github.com/denoland/deno/issues/9806
|
// https://github.com/denoland/deno/issues/9806
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { run: true } },
|
{ ignore: Deno.build.os === "windows", permissions: { run: true } },
|
||||||
async function signalPromiseTest2() {
|
async function signalPromiseTest2() {
|
||||||
const resolvable = deferred();
|
const resolvable = deferred();
|
||||||
// This prevents the program from exiting.
|
// This prevents the program from exiting.
|
||||||
|
@ -197,7 +203,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { run: true } },
|
{ ignore: Deno.build.os === "windows", permissions: { run: true } },
|
||||||
function signalShorthandsTest() {
|
function signalShorthandsTest() {
|
||||||
let s: Deno.SignalStream;
|
let s: Deno.SignalStream;
|
||||||
s = Deno.signal("SIGALRM");
|
s = Deno.signal("SIGALRM");
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
unitTest,
|
unitTest,
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function fstatSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function fstatSyncSuccess() {
|
||||||
const file = Deno.openSync("README.md");
|
const file = Deno.openSync("README.md");
|
||||||
const fileInfo = Deno.fstatSync(file.rid);
|
const fileInfo = Deno.fstatSync(file.rid);
|
||||||
assert(fileInfo.isFile);
|
assert(fileInfo.isFile);
|
||||||
|
@ -23,7 +23,7 @@ unitTest({ perms: { read: true } }, function fstatSyncSuccess() {
|
||||||
Deno.close(file.rid);
|
Deno.close(file.rid);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function fstatSuccess() {
|
unitTest({ permissions: { read: true } }, async function fstatSuccess() {
|
||||||
const file = await Deno.open("README.md");
|
const file = await Deno.open("README.md");
|
||||||
const fileInfo = await Deno.fstat(file.rid);
|
const fileInfo = await Deno.fstat(file.rid);
|
||||||
assert(fileInfo.isFile);
|
assert(fileInfo.isFile);
|
||||||
|
@ -39,7 +39,7 @@ unitTest({ perms: { read: true } }, async function fstatSuccess() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function statSyncSuccess() {
|
function statSyncSuccess() {
|
||||||
const readmeInfo = Deno.statSync("README.md");
|
const readmeInfo = Deno.statSync("README.md");
|
||||||
assert(readmeInfo.isFile);
|
assert(readmeInfo.isFile);
|
||||||
|
@ -101,19 +101,19 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function statSyncPerm() {
|
unitTest({ permissions: { read: false } }, function statSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.statSync("README.md");
|
Deno.statSync("README.md");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function statSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function statSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.statSync("bad_file_name");
|
Deno.statSync("bad_file_name");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function lstatSyncSuccess() {
|
unitTest({ permissions: { read: true } }, function lstatSyncSuccess() {
|
||||||
const packageInfo = Deno.lstatSync("README.md");
|
const packageInfo = Deno.lstatSync("README.md");
|
||||||
assert(packageInfo.isFile);
|
assert(packageInfo.isFile);
|
||||||
assert(!packageInfo.isSymlink);
|
assert(!packageInfo.isSymlink);
|
||||||
|
@ -141,20 +141,20 @@ unitTest({ perms: { read: true } }, function lstatSyncSuccess() {
|
||||||
assert(!coreInfoByUrl.isSymlink);
|
assert(!coreInfoByUrl.isSymlink);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, function lstatSyncPerm() {
|
unitTest({ permissions: { read: false } }, function lstatSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.lstatSync("hello.txt");
|
Deno.lstatSync("hello.txt");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function lstatSyncNotFound() {
|
unitTest({ permissions: { read: true } }, function lstatSyncNotFound() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.lstatSync("bad_file_name");
|
Deno.lstatSync("bad_file_name");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function statSuccess() {
|
async function statSuccess() {
|
||||||
const readmeInfo = await Deno.stat("README.md");
|
const readmeInfo = await Deno.stat("README.md");
|
||||||
assert(readmeInfo.isFile);
|
assert(readmeInfo.isFile);
|
||||||
|
@ -219,13 +219,13 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function statPerm() {
|
unitTest({ permissions: { read: false } }, async function statPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.stat("README.md");
|
await Deno.stat("README.md");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function statNotFound() {
|
unitTest({ permissions: { read: true } }, async function statNotFound() {
|
||||||
await assertRejects(
|
await assertRejects(
|
||||||
async () => {
|
async () => {
|
||||||
await Deno.stat("bad_file_name"), Deno.errors.NotFound;
|
await Deno.stat("bad_file_name"), Deno.errors.NotFound;
|
||||||
|
@ -233,7 +233,7 @@ unitTest({ perms: { read: true } }, async function statNotFound() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function lstatSuccess() {
|
unitTest({ permissions: { read: true } }, async function lstatSuccess() {
|
||||||
const readmeInfo = await Deno.lstat("README.md");
|
const readmeInfo = await Deno.lstat("README.md");
|
||||||
assert(readmeInfo.isFile);
|
assert(readmeInfo.isFile);
|
||||||
assert(!readmeInfo.isSymlink);
|
assert(!readmeInfo.isSymlink);
|
||||||
|
@ -261,20 +261,23 @@ unitTest({ perms: { read: true } }, async function lstatSuccess() {
|
||||||
assert(!coreInfoByUrl.isSymlink);
|
assert(!coreInfoByUrl.isSymlink);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: false } }, async function lstatPerm() {
|
unitTest({ permissions: { read: false } }, async function lstatPerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.lstat("README.md");
|
await Deno.lstat("README.md");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function lstatNotFound() {
|
unitTest({ permissions: { read: true } }, async function lstatNotFound() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.lstat("bad_file_name");
|
await Deno.lstat("bad_file_name");
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os !== "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os !== "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function statNoUnixFields() {
|
function statNoUnixFields() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -295,7 +298,10 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
{
|
||||||
|
ignore: Deno.build.os === "windows",
|
||||||
|
permissions: { read: true, write: true },
|
||||||
|
},
|
||||||
function statUnixFields() {
|
function statUnixFields() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function symlinkSyncSuccess() {
|
function symlinkSyncSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldname = testDir + "/oldname";
|
const oldname = testDir + "/oldname";
|
||||||
|
@ -22,7 +22,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function symlinkSyncURL() {
|
function symlinkSyncURL() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldname = testDir + "/oldname";
|
const oldname = testDir + "/oldname";
|
||||||
|
@ -46,7 +46,7 @@ unitTest(function symlinkSyncPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function symlinkSuccess() {
|
async function symlinkSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldname = testDir + "/oldname";
|
const oldname = testDir + "/oldname";
|
||||||
|
@ -61,7 +61,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function symlinkURL() {
|
async function symlinkURL() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const oldname = testDir + "/oldname";
|
const oldname = testDir + "/oldname";
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { assertEquals, unitTest } from "./test_util.ts";
|
import { assertEquals, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function fdatasyncSyncSuccess() {
|
function fdatasyncSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_fdatasyncSync.txt";
|
const filename = Deno.makeTempDirSync() + "/test_fdatasyncSync.txt";
|
||||||
const file = Deno.openSync(filename, {
|
const file = Deno.openSync(filename, {
|
||||||
|
@ -20,7 +20,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function fdatasyncSuccess() {
|
async function fdatasyncSuccess() {
|
||||||
const filename = (await Deno.makeTempDir()) + "/test_fdatasync.txt";
|
const filename = (await Deno.makeTempDir()) + "/test_fdatasync.txt";
|
||||||
const file = await Deno.open(filename, {
|
const file = await Deno.open(filename, {
|
||||||
|
@ -38,7 +38,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function fsyncSyncSuccess() {
|
function fsyncSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_fsyncSync.txt";
|
const filename = Deno.makeTempDirSync() + "/test_fsyncSync.txt";
|
||||||
const file = Deno.openSync(filename, {
|
const file = Deno.openSync(filename, {
|
||||||
|
@ -56,7 +56,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function fsyncSuccess() {
|
async function fsyncSuccess() {
|
||||||
const filename = (await Deno.makeTempDir()) + "/test_fsync.txt";
|
const filename = (await Deno.makeTempDir()) + "/test_fsync.txt";
|
||||||
const file = await Deno.open(filename, {
|
const file = await Deno.open(filename, {
|
||||||
|
|
|
@ -27,19 +27,19 @@ export { readLines } from "../../../test_util/std/io/bufio.ts";
|
||||||
export { parse as parseArgs } from "../../../test_util/std/flags/mod.ts";
|
export { parse as parseArgs } from "../../../test_util/std/flags/mod.ts";
|
||||||
|
|
||||||
interface UnitTestPermissions {
|
interface UnitTestPermissions {
|
||||||
read?: boolean;
|
env?: "inherit" | boolean | string[];
|
||||||
write?: boolean;
|
hrtime?: "inherit" | boolean;
|
||||||
net?: boolean;
|
net?: "inherit" | boolean | string[];
|
||||||
env?: boolean;
|
ffi?: "inherit" | boolean;
|
||||||
run?: boolean;
|
read?: "inherit" | boolean | Array<string | URL>;
|
||||||
ffi?: boolean;
|
run?: "inherit" | boolean | Array<string | URL>;
|
||||||
hrtime?: boolean;
|
write?: "inherit" | boolean | Array<string | URL>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UnitTestOptions {
|
interface UnitTestOptions {
|
||||||
ignore?: boolean;
|
ignore?: boolean;
|
||||||
only?: boolean;
|
only?: boolean;
|
||||||
perms?: UnitTestPermissions;
|
permissions?: UnitTestPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestFunction = () => void | Promise<void>;
|
type TestFunction = () => void | Promise<void>;
|
||||||
|
@ -86,7 +86,7 @@ export function unitTest(
|
||||||
run: false,
|
run: false,
|
||||||
ffi: false,
|
ffi: false,
|
||||||
hrtime: false,
|
hrtime: false,
|
||||||
}, options.perms),
|
}, options.permissions),
|
||||||
};
|
};
|
||||||
|
|
||||||
Deno.test(testDefinition);
|
Deno.test(testDefinition);
|
||||||
|
|
|
@ -445,7 +445,7 @@ unitTest(async function timerIgnoresDateOverride() {
|
||||||
assertEquals(hasThrown, 1);
|
assertEquals(hasThrown, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { hrtime: true } }, function sleepSync() {
|
unitTest({ permissions: { hrtime: true } }, function sleepSync() {
|
||||||
const start = performance.now();
|
const start = performance.now();
|
||||||
Deno.sleepSync(10);
|
Deno.sleepSync(10);
|
||||||
const after = performance.now();
|
const after = performance.now();
|
||||||
|
@ -453,7 +453,7 @@ unitTest({ perms: { hrtime: true } }, function sleepSync() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { hrtime: true } },
|
{ permissions: { hrtime: true } },
|
||||||
async function sleepSyncShorterPromise() {
|
async function sleepSyncShorterPromise() {
|
||||||
const perf = performance;
|
const perf = performance;
|
||||||
const short = 5;
|
const short = 5;
|
||||||
|
@ -472,7 +472,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { hrtime: true } },
|
{ permissions: { hrtime: true } },
|
||||||
async function sleepSyncLongerPromise() {
|
async function sleepSyncLongerPromise() {
|
||||||
const perf = performance;
|
const perf = performance;
|
||||||
const short = 5;
|
const short = 5;
|
||||||
|
|
|
@ -32,7 +32,7 @@ unitTest(async function connectTLSNoPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSInvalidHost() {
|
async function connectTLSInvalidHost() {
|
||||||
const listener = await Deno.listenTls({
|
const listener = await Deno.listenTls({
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
|
@ -60,7 +60,7 @@ unitTest(async function connectTLSCertFileNoReadPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
function listenTLSNonExistentCertKeyFiles() {
|
function listenTLSNonExistentCertKeyFiles() {
|
||||||
const options = {
|
const options = {
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
|
@ -85,7 +85,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { net: true } }, function listenTLSNoReadPerm() {
|
unitTest({ permissions: { net: true } }, function listenTLSNoReadPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.listenTls({
|
Deno.listenTls({
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
|
@ -98,7 +98,7 @@ unitTest({ perms: { net: true } }, function listenTLSNoReadPerm() {
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{
|
{
|
||||||
perms: { read: true, write: true, net: true },
|
permissions: { read: true, write: true, net: true },
|
||||||
},
|
},
|
||||||
function listenTLSEmptyKeyFile() {
|
function listenTLSEmptyKeyFile() {
|
||||||
const options = {
|
const options = {
|
||||||
|
@ -124,7 +124,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true, net: true } },
|
{ permissions: { read: true, write: true, net: true } },
|
||||||
function listenTLSEmptyCertFile() {
|
function listenTLSEmptyCertFile() {
|
||||||
const options = {
|
const options = {
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
|
@ -149,7 +149,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function dialAndListenTLS() {
|
async function dialAndListenTLS() {
|
||||||
const resolvable = deferred();
|
const resolvable = deferred();
|
||||||
const hostname = "localhost";
|
const hostname = "localhost";
|
||||||
|
@ -301,7 +301,7 @@ async function receiveThenSend(
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamHalfCloseSendOneByte() {
|
async function tlsServerStreamHalfCloseSendOneByte() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -312,7 +312,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamHalfCloseSendOneByte() {
|
async function tlsClientStreamHalfCloseSendOneByte() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -323,7 +323,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamHalfCloseSendOneChunk() {
|
async function tlsServerStreamHalfCloseSendOneChunk() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -334,7 +334,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamHalfCloseSendOneChunk() {
|
async function tlsClientStreamHalfCloseSendOneChunk() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -345,7 +345,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamHalfCloseSendManyBytes() {
|
async function tlsServerStreamHalfCloseSendManyBytes() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -356,7 +356,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamHalfCloseSendManyBytes() {
|
async function tlsClientStreamHalfCloseSendManyBytes() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -367,7 +367,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamHalfCloseSendManyChunks() {
|
async function tlsServerStreamHalfCloseSendManyChunks() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -378,7 +378,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamHalfCloseSendManyChunks() {
|
async function tlsClientStreamHalfCloseSendManyChunks() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -428,7 +428,7 @@ async function receiveAlotSendNothing(conn: Deno.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamCancelRead() {
|
async function tlsServerStreamCancelRead() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -439,7 +439,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamCancelRead() {
|
async function tlsClientStreamCancelRead() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -485,7 +485,7 @@ async function sendReceiveEmptyBuf(conn: Deno.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsStreamSendReceiveEmptyBuf() {
|
async function tlsStreamSendReceiveEmptyBuf() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -511,7 +511,7 @@ async function closeWriteAndClose(conn: Deno.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsServerStreamImmediateClose() {
|
async function tlsServerStreamImmediateClose() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -522,7 +522,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientStreamImmediateClose() {
|
async function tlsClientStreamImmediateClose() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -533,7 +533,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsClientAndServerStreamImmediateClose() {
|
async function tlsClientAndServerStreamImmediateClose() {
|
||||||
const [serverConn, clientConn] = await tlsPair();
|
const [serverConn, clientConn] = await tlsPair();
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -776,7 +776,7 @@ async function tlsWithTcpFailureTestImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpCorruptionImmediately() {
|
async function tlsHandshakeWithTcpCorruptionImmediately() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 0, "corruption", false);
|
await tlsWithTcpFailureTestImpl("handshake", 0, "corruption", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 0, "corruption", true);
|
await tlsWithTcpFailureTestImpl("handshake", 0, "corruption", true);
|
||||||
|
@ -784,7 +784,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpShutdownImmediately() {
|
async function tlsHandshakeWithTcpShutdownImmediately() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 0, "shutdown", false);
|
await tlsWithTcpFailureTestImpl("handshake", 0, "shutdown", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 0, "shutdown", true);
|
await tlsWithTcpFailureTestImpl("handshake", 0, "shutdown", true);
|
||||||
|
@ -792,7 +792,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpCorruptionAfter70Bytes() {
|
async function tlsHandshakeWithTcpCorruptionAfter70Bytes() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 76, "corruption", false);
|
await tlsWithTcpFailureTestImpl("handshake", 76, "corruption", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 78, "corruption", true);
|
await tlsWithTcpFailureTestImpl("handshake", 78, "corruption", true);
|
||||||
|
@ -800,7 +800,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpShutdownAfter70bytes() {
|
async function tlsHandshakeWithTcpShutdownAfter70bytes() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 77, "shutdown", false);
|
await tlsWithTcpFailureTestImpl("handshake", 77, "shutdown", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 79, "shutdown", true);
|
await tlsWithTcpFailureTestImpl("handshake", 79, "shutdown", true);
|
||||||
|
@ -808,7 +808,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpCorruptionAfter200Bytes() {
|
async function tlsHandshakeWithTcpCorruptionAfter200Bytes() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 200, "corruption", false);
|
await tlsWithTcpFailureTestImpl("handshake", 200, "corruption", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 202, "corruption", true);
|
await tlsWithTcpFailureTestImpl("handshake", 202, "corruption", true);
|
||||||
|
@ -816,7 +816,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsHandshakeWithTcpShutdownAfter200bytes() {
|
async function tlsHandshakeWithTcpShutdownAfter200bytes() {
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 201, "shutdown", false);
|
await tlsWithTcpFailureTestImpl("handshake", 201, "shutdown", false);
|
||||||
await tlsWithTcpFailureTestImpl("handshake", 203, "shutdown", true);
|
await tlsWithTcpFailureTestImpl("handshake", 203, "shutdown", true);
|
||||||
|
@ -824,7 +824,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsTrafficWithTcpCorruption() {
|
async function tlsTrafficWithTcpCorruption() {
|
||||||
await tlsWithTcpFailureTestImpl("traffic", Infinity, "corruption", false);
|
await tlsWithTcpFailureTestImpl("traffic", Infinity, "corruption", false);
|
||||||
await tlsWithTcpFailureTestImpl("traffic", Infinity, "corruption", true);
|
await tlsWithTcpFailureTestImpl("traffic", Infinity, "corruption", true);
|
||||||
|
@ -832,7 +832,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function tlsTrafficWithTcpShutdown() {
|
async function tlsTrafficWithTcpShutdown() {
|
||||||
await tlsWithTcpFailureTestImpl("traffic", Infinity, "shutdown", false);
|
await tlsWithTcpFailureTestImpl("traffic", Infinity, "shutdown", false);
|
||||||
await tlsWithTcpFailureTestImpl("traffic", Infinity, "shutdown", true);
|
await tlsWithTcpFailureTestImpl("traffic", Infinity, "shutdown", true);
|
||||||
|
@ -913,7 +913,7 @@ async function curl(url: string): Promise<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true, run: true } },
|
{ permissions: { read: true, net: true, run: true } },
|
||||||
async function curlFakeHttpsServer() {
|
async function curlFakeHttpsServer() {
|
||||||
const port = getPort();
|
const port = getPort();
|
||||||
const listener = createHttpsListener(port);
|
const listener = createHttpsListener(port);
|
||||||
|
@ -937,7 +937,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function startTls() {
|
async function startTls() {
|
||||||
const hostname = "smtp.gmail.com";
|
const hostname = "smtp.gmail.com";
|
||||||
const port = 587;
|
const port = 587;
|
||||||
|
@ -988,7 +988,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSBadClientCertPrivateKey(): Promise<void> {
|
async function connectTLSBadClientCertPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
@ -1004,7 +1004,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSBadPrivateKey(): Promise<void> {
|
async function connectTLSBadPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
@ -1020,7 +1020,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectTLSNotPrivateKey(): Promise<void> {
|
async function connectTLSNotPrivateKey(): Promise<void> {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.connectTls({
|
await Deno.connectTls({
|
||||||
|
@ -1036,7 +1036,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, net: true } },
|
{ permissions: { read: true, net: true } },
|
||||||
async function connectWithClientCert() {
|
async function connectWithClientCert() {
|
||||||
// The test_server running on port 4552 responds with 'PASS' if client
|
// The test_server running on port 4552 responds with 'PASS' if client
|
||||||
// authentication was successful. Try it by running test_server and
|
// authentication was successful. Try it by running test_server and
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function ftruncateSyncSuccess() {
|
function ftruncateSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_ftruncateSync.txt";
|
const filename = Deno.makeTempDirSync() + "/test_ftruncateSync.txt";
|
||||||
const file = Deno.openSync(filename, {
|
const file = Deno.openSync(filename, {
|
||||||
|
@ -29,7 +29,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function ftruncateSuccess() {
|
async function ftruncateSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_ftruncate.txt";
|
const filename = Deno.makeTempDirSync() + "/test_ftruncate.txt";
|
||||||
const file = await Deno.open(filename, {
|
const file = await Deno.open(filename, {
|
||||||
|
@ -51,7 +51,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function truncateSyncSuccess() {
|
function truncateSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_truncateSync.txt";
|
const filename = Deno.makeTempDirSync() + "/test_truncateSync.txt";
|
||||||
Deno.writeFileSync(filename, new Uint8Array(5));
|
Deno.writeFileSync(filename, new Uint8Array(5));
|
||||||
|
@ -66,7 +66,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function truncateSuccess() {
|
async function truncateSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test_truncate.txt";
|
const filename = Deno.makeTempDirSync() + "/test_truncate.txt";
|
||||||
await Deno.writeFile(filename, new Uint8Array(5));
|
await Deno.writeFile(filename, new Uint8Array(5));
|
||||||
|
@ -80,13 +80,13 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, function truncateSyncPerm() {
|
unitTest({ permissions: { write: false } }, function truncateSyncPerm() {
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.truncateSync("/test_truncateSyncPermission.txt");
|
Deno.truncateSync("/test_truncateSyncPermission.txt");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, async function truncatePerm() {
|
unitTest({ permissions: { write: false } }, async function truncatePerm() {
|
||||||
await assertRejects(async () => {
|
await assertRejects(async () => {
|
||||||
await Deno.truncate("/test_truncatePermission.txt");
|
await Deno.truncate("/test_truncatePermission.txt");
|
||||||
}, Deno.errors.PermissionDenied);
|
}, Deno.errors.PermissionDenied);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { assert, assertThrows, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
// Note tests for Deno.setRaw is in integration tests.
|
// Note tests for Deno.setRaw is in integration tests.
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function consoleSizeFile() {
|
unitTest({ permissions: { read: true } }, function consoleSizeFile() {
|
||||||
const file = Deno.openSync("cli/tests/testdata/hello.txt");
|
const file = Deno.openSync("cli/tests/testdata/hello.txt");
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
Deno.consoleSize(file.rid);
|
Deno.consoleSize(file.rid);
|
||||||
|
@ -18,7 +18,7 @@ unitTest(function consoleSizeError() {
|
||||||
}, Deno.errors.BadResource);
|
}, Deno.errors.BadResource);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, function isatty() {
|
unitTest({ permissions: { read: true } }, function isatty() {
|
||||||
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
// CI not under TTY, so cannot test stdin/stdout/stderr.
|
||||||
const f = Deno.openSync("cli/tests/testdata/hello.txt");
|
const f = Deno.openSync("cli/tests/testdata/hello.txt");
|
||||||
assert(!Deno.isatty(f.rid));
|
assert(!Deno.isatty(f.rid));
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function futimeSyncSuccess() {
|
async function futimeSyncSuccess() {
|
||||||
const testDir = await Deno.makeTempDir();
|
const testDir = await Deno.makeTempDir();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -30,7 +30,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function futimeSyncSuccess() {
|
function futimeSyncSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -52,7 +52,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncFileSuccess() {
|
function utimeSyncFileSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -71,7 +71,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncUrlSuccess() {
|
function utimeSyncUrlSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -90,7 +90,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncDirectorySuccess() {
|
function utimeSyncDirectorySuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncDateSuccess() {
|
function utimeSyncDateSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncFileDateSuccess() {
|
function utimeSyncFileDateSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -138,7 +138,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncLargeNumberSuccess() {
|
function utimeSyncLargeNumberSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function utimeSyncNotFound() {
|
function utimeSyncNotFound() {
|
||||||
const atime = 1000;
|
const atime = 1000;
|
||||||
const mtime = 50000;
|
const mtime = 50000;
|
||||||
|
@ -167,7 +167,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
function utimeSyncPerm() {
|
function utimeSyncPerm() {
|
||||||
const atime = 1000;
|
const atime = 1000;
|
||||||
const mtime = 50000;
|
const mtime = 50000;
|
||||||
|
@ -179,7 +179,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeFileSuccess() {
|
async function utimeFileSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -198,7 +198,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeUrlSuccess() {
|
async function utimeUrlSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -217,7 +217,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeDirectorySuccess() {
|
async function utimeDirectorySuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeDateSuccess() {
|
async function utimeDateSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeFileDateSuccess() {
|
async function utimeFileDateSuccess() {
|
||||||
const testDir = Deno.makeTempDirSync();
|
const testDir = Deno.makeTempDirSync();
|
||||||
const filename = testDir + "/file.txt";
|
const filename = testDir + "/file.txt";
|
||||||
|
@ -266,7 +266,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function utimeNotFound() {
|
async function utimeNotFound() {
|
||||||
const atime = 1000;
|
const atime = 1000;
|
||||||
const mtime = 50000;
|
const mtime = 50000;
|
||||||
|
@ -278,7 +278,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
async function utimeSyncPerm() {
|
async function utimeSyncPerm() {
|
||||||
const atime = 1000;
|
const atime = 1000;
|
||||||
const mtime = 50000;
|
const mtime = 50000;
|
||||||
|
|
|
@ -77,7 +77,7 @@ unitTest(async function wasmInstantiateStreaming() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { net: true } },
|
{ permissions: { net: true } },
|
||||||
async function wasmStreamingNonTrivial() {
|
async function wasmStreamingNonTrivial() {
|
||||||
// deno-dom's WASM file is a real-world non-trivial case that gave us
|
// deno-dom's WASM file is a real-world non-trivial case that gave us
|
||||||
// trouble when implementing this.
|
// trouble when implementing this.
|
||||||
|
|
|
@ -384,7 +384,7 @@ const pkcs8TestVectors = [
|
||||||
"cli/tests/testdata/webcrypto/id_rsassaPss.pem",
|
"cli/tests/testdata/webcrypto/id_rsassaPss.pem",
|
||||||
];
|
];
|
||||||
|
|
||||||
unitTest({ perms: { read: true } }, async function importRsaPkcs8() {
|
unitTest({ permissions: { read: true } }, async function importRsaPkcs8() {
|
||||||
const pemHeader = "-----BEGIN PRIVATE KEY-----";
|
const pemHeader = "-----BEGIN PRIVATE KEY-----";
|
||||||
const pemFooter = "-----END PRIVATE KEY-----";
|
const pemFooter = "-----END PRIVATE KEY-----";
|
||||||
for (const keyFile of pkcs8TestVectors) {
|
for (const keyFile of pkcs8TestVectors) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ try {
|
||||||
// Skip this test on linux CI, because the vulkan emulator is not good enough
|
// Skip this test on linux CI, because the vulkan emulator is not good enough
|
||||||
// yet, and skip on macOS because these do not have virtual GPUs.
|
// yet, and skip on macOS because these do not have virtual GPUs.
|
||||||
unitTest({
|
unitTest({
|
||||||
perms: { read: true, env: true },
|
permissions: { read: true, env: true },
|
||||||
ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
|
ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
|
||||||
}, async function webgpuComputePass() {
|
}, async function webgpuComputePass() {
|
||||||
const adapter = await navigator.gpu.requestAdapter();
|
const adapter = await navigator.gpu.requestAdapter();
|
||||||
|
@ -101,7 +101,7 @@ unitTest({
|
||||||
// Skip this test on linux CI, because the vulkan emulator is not good enough
|
// Skip this test on linux CI, because the vulkan emulator is not good enough
|
||||||
// yet, and skip on macOS because these do not have virtual GPUs.
|
// yet, and skip on macOS because these do not have virtual GPUs.
|
||||||
unitTest({
|
unitTest({
|
||||||
perms: { read: true, env: true },
|
permissions: { read: true, env: true },
|
||||||
ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
|
ignore: (Deno.build.os === "linux" || Deno.build.os === "darwin") && isCI,
|
||||||
}, async function webgpuHelloTriangle() {
|
}, async function webgpuHelloTriangle() {
|
||||||
const adapter = await navigator.gpu.requestAdapter();
|
const adapter = await navigator.gpu.requestAdapter();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { assert, unitTest } from "./test_util.ts";
|
import { assert, unitTest } from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true } },
|
{ permissions: { read: true } },
|
||||||
function utimeSyncFileSuccess() {
|
function utimeSyncFileSuccess() {
|
||||||
const w = new Worker(
|
const w = new Worker(
|
||||||
new URL("../workers/worker_types.ts", import.meta.url).href,
|
new URL("../workers/worker_types.ts", import.meta.url).href,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeFileSyncSuccess() {
|
function writeFileSyncSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -21,7 +21,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeFileSyncUrl() {
|
function writeFileSyncUrl() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -39,7 +39,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function writeFileSyncFail() {
|
unitTest({ permissions: { write: true } }, function writeFileSyncFail() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
|
@ -49,7 +49,7 @@ unitTest({ perms: { write: true } }, function writeFileSyncFail() {
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, function writeFileSyncPerm() {
|
unitTest({ permissions: { write: false } }, function writeFileSyncPerm() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
|
@ -60,7 +60,7 @@ unitTest({ perms: { write: false } }, function writeFileSyncPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeFileSyncUpdateMode() {
|
function writeFileSyncUpdateMode() {
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
@ -75,7 +75,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeFileSyncCreate() {
|
function writeFileSyncCreate() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -96,7 +96,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeFileSyncAppend() {
|
function writeFileSyncAppend() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -121,7 +121,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileSuccess() {
|
async function writeFileSuccess() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -135,7 +135,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileUrl() {
|
async function writeFileUrl() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -154,7 +154,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileNotFound() {
|
async function writeFileNotFound() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -167,7 +167,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: false } },
|
{ permissions: { read: true, write: false } },
|
||||||
async function writeFilePerm() {
|
async function writeFilePerm() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -180,7 +180,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileUpdateMode() {
|
async function writeFileUpdateMode() {
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
@ -195,7 +195,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileCreate() {
|
async function writeFileCreate() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -216,7 +216,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileAppend() {
|
async function writeFileAppend() {
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const data = enc.encode("Hello");
|
const data = enc.encode("Hello");
|
||||||
|
@ -241,7 +241,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileAbortSignal(): Promise<void> {
|
async function writeFileAbortSignal(): Promise<void> {
|
||||||
const ac = new AbortController();
|
const ac = new AbortController();
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
@ -259,7 +259,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeFileAbortSignalPreAborted(): Promise<void> {
|
async function writeFileAbortSignalPreAborted(): Promise<void> {
|
||||||
const ac = new AbortController();
|
const ac = new AbortController();
|
||||||
ac.abort();
|
ac.abort();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "./test_util.ts";
|
} from "./test_util.ts";
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeTextFileSyncSuccess() {
|
function writeTextFileSyncSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
Deno.writeTextFileSync(filename, "Hello");
|
Deno.writeTextFileSync(filename, "Hello");
|
||||||
|
@ -17,7 +17,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeTextFileSyncByUrl() {
|
function writeTextFileSyncByUrl() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fileUrl = new URL(
|
const fileUrl = new URL(
|
||||||
|
@ -31,7 +31,7 @@ unitTest(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest({ perms: { write: true } }, function writeTextFileSyncFail() {
|
unitTest({ permissions: { write: true } }, function writeTextFileSyncFail() {
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
// The following should fail because /baddir doesn't exist (hopefully).
|
// The following should fail because /baddir doesn't exist (hopefully).
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
|
@ -39,7 +39,7 @@ unitTest({ perms: { write: true } }, function writeTextFileSyncFail() {
|
||||||
}, Deno.errors.NotFound);
|
}, Deno.errors.NotFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest({ perms: { write: false } }, function writeTextFileSyncPerm() {
|
unitTest({ permissions: { write: false } }, function writeTextFileSyncPerm() {
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
// The following should fail due to no write permission
|
// The following should fail due to no write permission
|
||||||
assertThrows(() => {
|
assertThrows(() => {
|
||||||
|
@ -48,7 +48,7 @@ unitTest({ perms: { write: false } }, function writeTextFileSyncPerm() {
|
||||||
});
|
});
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeTextFileSyncUpdateMode() {
|
function writeTextFileSyncUpdateMode() {
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
|
@ -62,7 +62,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeTextFileSyncCreate() {
|
function writeTextFileSyncCreate() {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
@ -84,7 +84,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
function writeTextFileSyncAppend() {
|
function writeTextFileSyncAppend() {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
@ -101,7 +101,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileSuccess() {
|
async function writeTextFileSuccess() {
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
await Deno.writeTextFile(filename, "Hello");
|
await Deno.writeTextFile(filename, "Hello");
|
||||||
|
@ -111,7 +111,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileByUrl() {
|
async function writeTextFileByUrl() {
|
||||||
const tempDir = Deno.makeTempDirSync();
|
const tempDir = Deno.makeTempDirSync();
|
||||||
const fileUrl = new URL(
|
const fileUrl = new URL(
|
||||||
|
@ -126,7 +126,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileNotFound() {
|
async function writeTextFileNotFound() {
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
// The following should fail because /baddir doesn't exist (hopefully).
|
// The following should fail because /baddir doesn't exist (hopefully).
|
||||||
|
@ -137,7 +137,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { write: false } },
|
{ permissions: { write: false } },
|
||||||
async function writeTextFilePerm() {
|
async function writeTextFilePerm() {
|
||||||
const filename = "/baddir/test.txt";
|
const filename = "/baddir/test.txt";
|
||||||
// The following should fail due to no write permission
|
// The following should fail due to no write permission
|
||||||
|
@ -148,7 +148,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileUpdateMode() {
|
async function writeTextFileUpdateMode() {
|
||||||
if (Deno.build.os !== "windows") {
|
if (Deno.build.os !== "windows") {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
|
@ -162,7 +162,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileCreate() {
|
async function writeTextFileCreate() {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
@ -184,7 +184,7 @@ unitTest(
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ perms: { read: true, write: true } },
|
{ permissions: { read: true, write: true } },
|
||||||
async function writeTextFileAppend() {
|
async function writeTextFileAppend() {
|
||||||
const data = "Hello";
|
const data = "Hello";
|
||||||
const filename = Deno.makeTempDirSync() + "/test.txt";
|
const filename = Deno.makeTempDirSync() + "/test.txt";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue