summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ctypes/argument-length-cdata.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/jit-test/tests/ctypes/argument-length-cdata.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ctypes/argument-length-cdata.js b/js/src/jit-test/tests/ctypes/argument-length-cdata.js
new file mode 100644
index 0000000000..2dc6ff8cd0
--- /dev/null
+++ b/js/src/jit-test/tests/ctypes/argument-length-cdata.js
@@ -0,0 +1,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();