Debian Codegraph @

js/src/jit-test/tests/ctypes/cast.js

raw
1 load(libdir + 'asserts.js');
2
3 function test() {
4 assertTypeErrorMessage(() => { ctypes.cast(ctypes.int32_t(0), ctypes.StructType("foo")); },
5 "target type foo has undefined size");
6
7 assertTypeErrorMessage(() => { ctypes.cast(ctypes.int32_t(0), ctypes.StructType("foo", [ { x: ctypes.int32_t }, { y: ctypes.int32_t } ])); },
8 "target type foo has larger size than source type ctypes.int32_t (8 > 4)");
9 }
10
11 if (typeof ctypes === "object")
12 test();