Debian Codegraph @

js/src/jit-test/tests/ctypes/incompatible-function.js

raw
1 load(libdir + 'asserts.js');
2
3 function test() {
4 assertTypeErrorMessage(() => { ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).call.call(1); },
5 "Function.prototype.call called on incompatible number");
6 assertTypeErrorMessage(() => { ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).call.call(ctypes.int32_t(0)); },
7 "FunctionType.prototype.call called on non-PointerType CData, got ctypes.int32_t(0)");
8 assertTypeErrorMessage(() => { ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).call.call(ctypes.int32_t.ptr(0)); },
9 "FunctionType.prototype.call called on non-FunctionType pointer, got ctypes.int32_t.ptr(ctypes.UInt64(\"0x0\"))");
10 }
11
12 if (typeof ctypes === "object")
13 test();