aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets')
-rw-r--r--integration/bunjs-only-snippets/ffi.test.js25
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();
+});
+``;