diff options
author | 2022-04-28 06:55:45 -0700 | |
---|---|---|
committer | 2022-04-29 00:47:26 -0700 | |
commit | ef18443b6e3ae3a0644a12e1e687846f6a6e6f2f (patch) | |
tree | a3c9b0850182ff5ae1a503df93653671b0bd0a9e /integration/bunjs-only-snippets/ffi.test.js | |
parent | d066c7de30a8a6d5aa404a2116d3f5d71639cbd9 (diff) | |
download | bun-ef18443b6e3ae3a0644a12e1e687846f6a6e6f2f.tar.gz bun-ef18443b6e3ae3a0644a12e1e687846f6a6e6f2f.tar.zst bun-ef18443b6e3ae3a0644a12e1e687846f6a6e6f2f.zip |
some tests but need more
Diffstat (limited to 'integration/bunjs-only-snippets/ffi.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/ffi.test.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/ffi.test.js b/integration/bunjs-only-snippets/ffi.test.js new file mode 100644 index 000000000..bc3ac1f2a --- /dev/null +++ b/integration/bunjs-only-snippets/ffi.test.js @@ -0,0 +1,25 @@ +import { describe, it, expect } from "bun:test"; + +it("ffi print", () => { + Bun.dlprint({ + add: { + params: ["int32_t", "int32_t"], + return_type: "int32_t", + }, + })[0]; +}); + +it("ffi run", () => { + const { + symbols: { add }, + close, + } = Bun.dlopen("/tmp/libffi-test.dylib", { + add: { + params: ["int32_t", "int32_t"], + return_type: "int32_t", + }, + }); + expect(add(1, 2)).toBe(3); + close(); +}); +``; |