summaryrefslogtreecommitdiff
path: root/tests/unit/ffi_test.ts
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-09-10 20:12:24 +0200
committerGitHub <noreply@github.com>2024-09-10 11:12:24 -0700
commit7bfcb4dd10d31f5f9566c90a28449c0951f3a48e (patch)
treefca0dec6e98118418f1712c6e8451a04c7e89988 /tests/unit/ffi_test.ts
parentbe5419d479fcae16c8a07dec00ce11b532b7996a (diff)
feat(cli): use NotCapable error for permission errors (#25431)
Closes #7394 --------- Co-authored-by: snek <snek@deno.com>
Diffstat (limited to 'tests/unit/ffi_test.ts')
-rw-r--r--tests/unit/ffi_test.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/unit/ffi_test.ts b/tests/unit/ffi_test.ts
index 70a914c0a..98338b15e 100644
--- a/tests/unit/ffi_test.ts
+++ b/tests/unit/ffi_test.ts
@@ -24,10 +24,10 @@ Deno.test({ permissions: { ffi: true } }, function dlopenInvalidArguments() {
}, TypeError);
});
-Deno.test({ permissions: { ffi: false } }, function ffiPermissionDenied() {
+Deno.test({ permissions: { ffi: false } }, function ffiNotCapable() {
assertThrows(() => {
Deno.dlopen("/usr/lib/libc.so.6", {});
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
const fnptr = new Deno.UnsafeFnPointer(
// @ts-expect-error: Not NonNullable but null check is after permissions check.
null,
@@ -38,44 +38,44 @@ Deno.test({ permissions: { ffi: false } }, function ffiPermissionDenied() {
);
assertThrows(() => {
fnptr.call(123, null);
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
Deno.UnsafePointer.of(new Uint8Array(0));
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
const ptrView = new Deno.UnsafePointerView(
// @ts-expect-error: Not NonNullable but null check is after permissions check.
null,
);
assertThrows(() => {
ptrView.copyInto(new Uint8Array(0));
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getCString();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getUint8();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getInt8();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getUint16();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getInt16();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getUint32();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getInt32();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getFloat32();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
assertThrows(() => {
ptrView.getFloat64();
- }, Deno.errors.PermissionDenied);
+ }, Deno.errors.NotCapable);
});
Deno.test({ permissions: { ffi: true } }, function pointerOf() {