summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ctypes/incompatible-array.js
blob: 968da010983aba056fa201abb2a257f882704766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
load(libdir + 'asserts.js');

function test() {
  assertTypeErrorMessage(() => { ctypes.int32_t.array.call(1); },
                         "CType.prototype.array called on incompatible object, got the number 1");
  assertTypeErrorMessage(() => { ctypes.int32_t.array(10)().addressOfElement.call(1); },
                         "ArrayType.prototype.addressOfElement called on incompatible object, got the number 1");
  assertTypeErrorMessage(() => { ctypes.int32_t.array(10)().addressOfElement.call(ctypes.int32_t(0)); },
                         "ArrayType.prototype.addressOfElement called on non-ArrayType CData, got ctypes.int32_t(0)");
}

if (typeof ctypes === "object")
  test();