GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: reuse ffi.suffix instead of reimplementing it · nodejs/node@b9e596f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/ffi
    • ffi-test-common.js
    • test-ffi-module.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/ffi/ffi-test-common.js‎

Copy file name to clipboardExpand all lines: test/ffi/ffi-test-common.js
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@ const path = require('node:path');
66

77
common.skipIfFFIMissing();
88

9+
const { suffix } = require('node:ffi');
10+
911
const fixtureBuildDir = path.join(
1012
__dirname,
1113
'fixture_library',
1214
'build',
1315
common.buildType,
1416
);
15-
const libraryPath = path.join(
16-
fixtureBuildDir,
17-
process.platform === 'win32' ? 'ffi_test_library.dll' :
18-
process.platform === 'darwin' ? 'ffi_test_library.dylib' :
19-
'ffi_test_library.so',
20-
);
17+
const libraryPath = path.join(fixtureBuildDir, `ffi_test_library.${suffix}`);
2118

2219
function ensureFixtureLibrary() {
2320
if (!fs.existsSync(libraryPath)) {
Collapse file

‎test/ffi/test-ffi-module.js‎

Copy file name to clipboardExpand all lines: test/ffi/test-ffi-module.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ test('ffi exports expected API surface', () => {
154154
assert.strictEqual(typeof ffi.types, 'object');
155155
});
156156

157+
test('ffi.suffix matches the current platform', () => {
158+
const ffi = require('node:ffi');
159+
const expected = process.platform === 'win32' ? 'dll' :
160+
process.platform === 'darwin' ? 'dylib' : 'so';
161+
162+
assert.strictEqual(ffi.suffix, expected);
163+
});
164+
157165
test('ffi.types exports canonical type constants', () => {
158166
const ffi = require('node:ffi');
159167
const expected = {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.