Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions test/ffi/ffi-test-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ const path = require('node:path');

common.skipIfFFIMissing();

const { suffix } = require('node:ffi');

const fixtureBuildDir = path.join(
__dirname,
'fixture_library',
'build',
common.buildType,
);
const libraryPath = path.join(
fixtureBuildDir,
process.platform === 'win32' ? 'ffi_test_library.dll' :
process.platform === 'darwin' ? 'ffi_test_library.dylib' :
'ffi_test_library.so',
);
const libraryPath = path.join(fixtureBuildDir, `ffi_test_library.${suffix}`);

function ensureFixtureLibrary() {
if (!fs.existsSync(libraryPath)) {
Expand Down
8 changes: 8 additions & 0 deletions test/ffi/test-ffi-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ test('ffi exports expected API surface', () => {
assert.strictEqual(typeof ffi.types, 'object');
});

test('ffi.suffix matches the current platform', () => {
const ffi = require('node:ffi');
const expected = process.platform === 'win32' ? 'dll' :
process.platform === 'darwin' ? 'dylib' : 'so';

assert.strictEqual(ffi.suffix, expected);
});

test('ffi.types exports canonical type constants', () => {
const ffi = require('node:ffi');
const expected = {
Expand Down
Loading