Debian Codegraph @

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

raw
1 load(libdir + 'asserts.js');
2
3 function test() {
4 assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(1); },
5 "Int64.prototype.toString called on incompatible object, got the number 1");
6 assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(ctypes.int32_t(0)); },
7 "Int64.prototype.toString called on non-Int64 CData");
8 if (ctypes.Int64.prototype.toSource) {
9 assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(1); },
10 "Int64.prototype.toSource called on incompatible object, got the number 1");
11 assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(ctypes.int32_t(0)); },
12 "Int64.prototype.toSource called on non-Int64 CData");
13 }
14
15 assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(1); },
16 "UInt64.prototype.toString called on incompatible object, got the number 1");
17 assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(ctypes.int32_t(0)); },
18 "UInt64.prototype.toString called on non-UInt64 CData");
19 if (ctypes.UInt64.prototype.toSource) {
20 assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(1); },
21 "UInt64.prototype.toSource called on incompatible object, got the number 1");
22 assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(ctypes.int32_t(0)); },
23 "UInt64.prototype.toSource called on non-UInt64 CData");
24 }
25 }
26
27 if (typeof ctypes === "object")
28 test();