Debian Codegraph @

js/src/jit-test/tests/ctypes/conversion-to-primitive.js

raw
1 // Accessing `value` property of non primitive type should report its type.
2
3 load(libdir + 'asserts.js');
4
5 function test() {
6 let test_struct = ctypes.StructType("test_struct", [{ "x": ctypes.voidptr_t }]);
7 assertTypeErrorMessage(() => test_struct().value,
8 ".value only works on character and numeric types, not `test_struct`");
9
10 let test_array = ctypes.ArrayType(test_struct);
11 assertTypeErrorMessage(() => test_array(10).value,
12 ".value only works on character and numeric types, not `test_struct.array(10)`");
13
14 let test_pointer = ctypes.PointerType(test_struct);
15 assertTypeErrorMessage(() => test_pointer(10).value,
16 ".value only works on character and numeric types, not `test_struct.ptr`");
17 }
18
19 if (typeof ctypes === "object")
20 test();