summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ctypes/argument-length-cdata.js
blob: 2dc6ff8cd0ef6fa2074e06e69c85bdce48abb911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
load(libdir + 'asserts.js');

function test() {
  assertTypeErrorMessage(() => { ctypes.int32_t(0).address(1); },
                         "CData.prototype.address takes no arguments");
  assertTypeErrorMessage(() => { ctypes.char.array(10)().readString(1); },
                         "CData.prototype.readString takes no arguments");
  assertTypeErrorMessage(() => { ctypes.char.array(10)().readStringReplaceMalformed(1); },
                         "CData.prototype.readStringReplaceMalformed takes no arguments");

  if (ctypes.int32_t.prototype.toSource) {
    assertTypeErrorMessage(() => { ctypes.int32_t(0).toSource(1); },
                           "CData.prototype.toSource takes no arguments");
  }
}

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