Debian Codegraph @

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

raw
1 load(libdir + 'asserts.js');
2
3 function test() {
4 assertTypeErrorMessage(() => { ctypes.int32_t.array.call(1); },
5 "CType.prototype.array called on incompatible object, got the number 1");
6 assertTypeErrorMessage(() => { ctypes.int32_t.array(10)().addressOfElement.call(1); },
7 "ArrayType.prototype.addressOfElement called on incompatible object, got the number 1");
8 assertTypeErrorMessage(() => { ctypes.int32_t.array(10)().addressOfElement.call(ctypes.int32_t(0)); },
9 "ArrayType.prototype.addressOfElement called on non-ArrayType CData, got ctypes.int32_t(0)");
10 }
11
12 if (typeof ctypes === "object")
13 test();