mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +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
|
@ -8,7 +8,10 @@ import {
|
|||
} from "./test_util.ts";
|
||||
|
||||
unitTest(
|
||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
||||
{
|
||||
ignore: Deno.build.os === "windows",
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
function chmodSyncSuccess() {
|
||||
const enc = new TextEncoder();
|
||||
const data = enc.encode("Hello");
|
||||
|
@ -25,7 +28,10 @@ unitTest(
|
|||
);
|
||||
|
||||
unitTest(
|
||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
||||
{
|
||||
ignore: Deno.build.os === "windows",
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
function chmodSyncUrl() {
|
||||
const enc = new TextEncoder();
|
||||
const data = enc.encode("Hello");
|
||||
|
@ -47,7 +53,7 @@ unitTest(
|
|||
unitTest(
|
||||
{
|
||||
ignore: Deno.build.os === "windows",
|
||||
perms: { read: true, write: true },
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
function chmodSyncSymlinkSuccess() {
|
||||
const enc = new TextEncoder();
|
||||
|
@ -75,21 +81,24 @@ unitTest(
|
|||
},
|
||||
);
|
||||
|
||||
unitTest({ perms: { write: true } }, function chmodSyncFailure() {
|
||||
unitTest({ permissions: { write: true } }, function chmodSyncFailure() {
|
||||
assertThrows(() => {
|
||||
const filename = "/badfile.txt";
|
||||
Deno.chmodSync(filename, 0o777);
|
||||
}, Deno.errors.NotFound);
|
||||
});
|
||||
|
||||
unitTest({ perms: { write: false } }, function chmodSyncPerm() {
|
||||
unitTest({ permissions: { write: false } }, function chmodSyncPerm() {
|
||||
assertThrows(() => {
|
||||
Deno.chmodSync("/somefile.txt", 0o777);
|
||||
}, Deno.errors.PermissionDenied);
|
||||
});
|
||||
|
||||
unitTest(
|
||||
{ ignore: Deno.build.os === "windows", perms: { read: true, write: true } },
|
||||
{
|
||||
ignore: Deno.build.os === "windows",
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
async function chmodSuccess() {
|
||||
const enc = new TextEncoder();
|
||||
const data = enc.encode("Hello");
|
||||
|
@ -106,7 +115,10 @@ 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() {
|
||||
const enc = new TextEncoder();
|
||||
const data = enc.encode("Hello");
|
||||
|
@ -129,7 +141,7 @@ unitTest(
|
|||
unitTest(
|
||||
{
|
||||
ignore: Deno.build.os === "windows",
|
||||
perms: { read: true, write: true },
|
||||
permissions: { read: true, write: true },
|
||||
},
|
||||
async function chmodSymlinkSuccess() {
|
||||
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 () => {
|
||||
const filename = "/badfile.txt";
|
||||
await Deno.chmod(filename, 0o777);
|
||||
}, Deno.errors.NotFound);
|
||||
});
|
||||
|
||||
unitTest({ perms: { write: false } }, async function chmodPerm() {
|
||||
unitTest({ permissions: { write: false } }, async function chmodPerm() {
|
||||
await assertRejects(async () => {
|
||||
await Deno.chmod("/somefile.txt", 0o777);
|
||||
}, Deno.errors.PermissionDenied);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue