diff options
Diffstat (limited to 'js/src/jit-test/tests/ctypes/incompatible-int64.js')
-rw-r--r-- | js/src/jit-test/tests/ctypes/incompatible-int64.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ctypes/incompatible-int64.js b/js/src/jit-test/tests/ctypes/incompatible-int64.js new file mode 100644 index 000000000..3d53efba6 --- /dev/null +++ b/js/src/jit-test/tests/ctypes/incompatible-int64.js @@ -0,0 +1,24 @@ +load(libdir + 'asserts.js'); + +function test() { + assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(1); }, + "Int64.prototype.toString called on incompatible Number"); + assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(ctypes.int32_t(0)); }, + "Int64.prototype.toString called on non-Int64 CData"); + assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(1); }, + "Int64.prototype.toSource called on incompatible Number"); + assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(ctypes.int32_t(0)); }, + "Int64.prototype.toSource called on non-Int64 CData"); + + assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(1); }, + "UInt64.prototype.toString called on incompatible Number"); + assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(ctypes.int32_t(0)); }, + "UInt64.prototype.toString called on non-UInt64 CData"); + assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(1); }, + "UInt64.prototype.toSource called on incompatible Number"); + assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(ctypes.int32_t(0)); }, + "UInt64.prototype.toSource called on non-UInt64 CData"); +} + +if (typeof ctypes === "object") + test(); |