* FFI typo

* add tests

* it was a newline
This commit is contained in:
dave caruso
2023-08-04 16:08:50 -07:00
committed by GitHub
parent bdbc21ff7b
commit d196aa2de6
3 changed files with 10 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ const FFIType = {
fn: 17,
};
const suffix = process.platform === "win32" ? ".dll" : process.platform === "darwin" ? ".dylib" : ".so";
const suffix = process.platform === "win32" ? "dll" : process.platform === "darwin" ? "dylib" : "so";
declare const __GlobalBunFFIPtrFunctionForWrapper: typeof ptr;
declare const __GlobalBunCString: typeof CString;

File diff suppressed because one or more lines are too long

View File

@@ -10,6 +10,7 @@ import {
toArrayBuffer,
toBuffer,
viewSource,
suffix,
} from "bun:ffi";
const dlopen = (...args) => {
@@ -20,7 +21,7 @@ const dlopen = (...args) => {
throw err;
}
};
const ok = existsSync("/tmp/bun-ffi-test.dylib");
const ok = existsSync("/tmp/bun-ffi-test." + suffix);
it("ffi print", async () => {
await Bun.write(
@@ -626,3 +627,7 @@ it("dlopen throws an error instead of returning it", () => {
}
expect(err).toBeTruthy();
});
it('suffix does not start with a "."', () => {
expect(suffix).not.toMatch(/^\./);
});