mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Fixes: https://github.com/nodejs/node/issues/63461 Signed-off-by: Anshikakalpana <anshikajain196872@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63504 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
30 lines
792 B
JavaScript
30 lines
792 B
JavaScript
// Flags: --experimental-ffi
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
common.skipIfFFIMissing();
|
|
|
|
const assert = require('node:assert');
|
|
const ffi = require('node:ffi');
|
|
const { libraryPath } = require('./ffi-test-common');
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/63461
|
|
// 'void' as a parameter type should throw ERR_INVALID_ARG_VALUE
|
|
// instead of triggering ERR_INTERNAL_ASSERTION.
|
|
|
|
const lib = new ffi.DynamicLibrary(libraryPath);
|
|
|
|
try {
|
|
assert.throws(() => {
|
|
lib.getFunction('add_i32', { return: 'i32', arguments: ['void'] });
|
|
}, { code: 'ERR_INVALID_ARG_VALUE' });
|
|
|
|
assert.throws(() => {
|
|
lib.getFunctions({
|
|
add_i32: { return: 'i32', arguments: ['void'] },
|
|
});
|
|
}, { code: 'ERR_INVALID_ARG_VALUE' });
|
|
} finally {
|
|
lib.close();
|
|
}
|