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
|
@ -7,7 +7,7 @@ import {
|
|||
} from "./test_util.ts";
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
function ftruncateSyncSuccess() {
|
||||
const filename = Deno.makeTempDirSync() + "/test_ftruncateSync.txt";
|
||||
const file = Deno.openSync(filename, {
|
||||
|
@ -29,7 +29,7 @@ unitTest(
|
|||
);
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
async function ftruncateSuccess() {
|
||||
const filename = Deno.makeTempDirSync() + "/test_ftruncate.txt";
|
||||
const file = await Deno.open(filename, {
|
||||
|
@ -51,7 +51,7 @@ unitTest(
|
|||
);
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
function truncateSyncSuccess() {
|
||||
const filename = Deno.makeTempDirSync() + "/test_truncateSync.txt";
|
||||
Deno.writeFileSync(filename, new Uint8Array(5));
|
||||
|
@ -66,7 +66,7 @@ unitTest(
|
|||
);
|
||||
|
||||
unitTest(
|
||||
{ perms: { read: true, write: true } },
|
||||
{ permissions: { read: true, write: true } },
|
||||
async function truncateSuccess() {
|
||||
const filename = Deno.makeTempDirSync() + "/test_truncate.txt";
|
||||
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(() => {
|
||||
Deno.truncateSync("/test_truncateSyncPermission.txt");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
});
|
||||
|
||||
unitTest({ perms: { write: false } }, async function truncatePerm() {
|
||||
unitTest({ permissions: { write: false } }, async function truncatePerm() {
|
||||
await assertRejects(async () => {
|
||||
await Deno.truncate("/test_truncatePermission.txt");
|
||||
}, Deno.errors.PermissionDenied);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue