mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Enable node:ffi by default in builds with FFI support. Keep --experimental-ffi as a compatibility no-op and --no-experimental-ffi as an opt-out. Loading the module still emits an experimental warning. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/65475 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
29 lines
763 B
JavaScript
29 lines
763 B
JavaScript
'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();
|
|
}
|