mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
ffi: use type errors for invalid signatures
Signed-off-by: HoonDongKang <d159123@naver.com> PR-URL: https://github.com/nodejs/node/pull/66222 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
1 parent
e76358e3f1
commit
ad63e9ef29
2 files changed
+21
-3
No files matched your search
@@ -432,6 +432,24 @@ test('dynamic library APIs validate failures and bad signatures', () => {
|
||||
lib.getFunction('add_i32', { return: 'i32', arguments: ['i32\0bad'] });
|
||||
}, /Argument 0 of function add_i32 must not contain null bytes/);
|
||||
|
||||
assert.throws(() => {
|
||||
lib.getFunction('add_i32', { return: 1, arguments: [] });
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
lib.getFunction('add_i32', { return: 'i32', arguments: 'i32' });
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
lib.getFunction('add_i32', { return: 'i32', arguments: [1] });
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
});
|
||||
|
||||
assert.throws(() => {
|
||||
lib.getFunctions('not an object');
|
||||
}, {
|
||||
|
||||
Reference in new issue
Block a user