Debian Codegraph @

js/src/jit-test/tests/ctypes/argument-length-struct.js

raw
1 load(libdir + 'asserts.js');
2
3 function test() {
4 assertTypeErrorMessage(() => { ctypes.StructType(); },
5 "StructType takes one or two arguments");
6 assertTypeErrorMessage(() => { ctypes.StructType("a").define(); },
7 "StructType.prototype.define takes one argument");
8 assertTypeErrorMessage(() => { ctypes.StructType("a", [])(1, 2, 3); },
9 "StructType constructor takes at most one argument");
10 assertTypeErrorMessage(() => { ctypes.StructType("a", [ {"x": ctypes.int32_t }, {"y": ctypes.int32_t }, {"z": ctypes.int32_t }])(1, 2); },
11 "StructType constructor takes 0, 1, or 3 arguments");
12 assertTypeErrorMessage(() => { ctypes.StructType("a", [ {"x": ctypes.int32_t } ])().addressOfField(); },
13 "StructType.prototype.addressOfField takes one argument");
14 }
15
16 if (typeof ctypes === "object")
17 test();