| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 70cd5df commit b9e596f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,18 +6,15 @@ const path = require('node:path'); | |||
| 6 | 6 | ||
| 7 | 7 | common.skipIfFFIMissing(); | |
| 8 | 8 | ||
| 9 | + const { suffix } = require('node:ffi'); | ||
| 10 | + | ||
| 9 | 11 | const fixtureBuildDir = path.join( | |
| 10 | 12 | __dirname, | |
| 11 | 13 | 'fixture_library', | |
| 12 | 14 | 'build', | |
| 13 | 15 | common.buildType, | |
| 14 | 16 | ); | |
| 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}`); | ||
| 21 | 18 | ||
| 22 | 19 | function ensureFixtureLibrary() { | |
| 23 | 20 | if (!fs.existsSync(libraryPath)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -154,6 +154,14 @@ test('ffi exports expected API surface', () => { | |||
| 154 | 154 | assert.strictEqual(typeof ffi.types, 'object'); | |
| 155 | 155 | }); | |
| 156 | 156 | ||
| 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 | + | ||
| 157 | 165 | test('ffi.types exports canonical type constants', () => { | |
| 158 | 166 | const ffi = require('node:ffi'); | |
| 159 | 167 | const expected = { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments