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

function test() {
  assertRangeErrorMessage(() => { ctypes.Int64("0xfffffffffffffffffffffff"); },
                          "the string \"0xfffffffffffffffffffffff\" does not fit in the type int64");
  assertTypeErrorMessage(() => { ctypes.Int64.join("foo", 0); },
                         "can't pass the string \"foo\" to argument 1 of Int64.join");
  assertTypeErrorMessage(() => { ctypes.Int64.join(0, "foo"); },
                         "can't pass the string \"foo\" to argument 2 of Int64.join");

  assertRangeErrorMessage(() => { ctypes.UInt64("0xfffffffffffffffffffffff"); },
                          "the string \"0xfffffffffffffffffffffff\" does not fit in the type uint64");
  assertTypeErrorMessage(() => { ctypes.UInt64.join("foo", 0); },
                         "can't pass the string \"foo\" to argument 1 of UInt64.join");
  assertTypeErrorMessage(() => { ctypes.UInt64.join(0, "foo"); },
                         "can't pass the string \"foo\" to argument 2 of UInt64.join");
}

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