aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/ffi.test.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-16 15:46:20 -0700
committerGravatar GitHub <noreply@github.com> 2022-05-16 15:46:20 -0700
commita37f86e89dc01f884a1b4474c27c79d5932093a0 (patch)
tree4732a1a1c032f2e6788f3b8d7151c5d5db15fb38 /integration/bunjs-only-snippets/ffi.test.js
parent2bd0dcfdfaf6c385e927570b0e102385dc8c3975 (diff)
downloadbun-a37f86e89dc01f884a1b4474c27c79d5932093a0.tar.gz
bun-a37f86e89dc01f884a1b4474c27c79d5932093a0.tar.zst
bun-a37f86e89dc01f884a1b4474c27c79d5932093a0.zip
`bun:sqlite` (#167)
* :scissors: * Add the slow version * draw the rest of the owl * Fix crash when allocating lots of memory * [Bun.Transipiler] Support passing objects * [JS Parser] Support passing objects to macros via Bun.Transpiler * Update JSSQLStatement.cpp * Embed SQLite * Add SQLite to Dockerfile * [sqlite] Add quick one-off queries without creating a whole object * [sqlite] Add `columnsCount`, rename raw() to `values()`, remove `rebind` * Implement `bun:sqlite` * return null * Fix updating query * Update bun.d.ts * more tests * Support variadic arguments, write tests and add types * Update sqlite.d.ts * Update sqlite.d.ts * latest * Implement `Database.loadExtension` and `Database.setCustomSQLite` * Support `require.resolve` * [napi] Improve string performance * [bun.js] Support some of `node:module` * another test * [sqlite] Support serialize & deserialize * [`bun:ffi`] Implement `CFunction` and `linkSymbols` * [bun.js] Fix crash in `Buffer.from` * Update sqlite.test.js * Document linkSymbols * docs * Update README.md
Diffstat (limited to 'integration/bunjs-only-snippets/ffi.test.js')
-rw-r--r--integration/bunjs-only-snippets/ffi.test.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/integration/bunjs-only-snippets/ffi.test.js b/integration/bunjs-only-snippets/ffi.test.js
index 9198df3f7..6698ae51b 100644
--- a/integration/bunjs-only-snippets/ffi.test.js
+++ b/integration/bunjs-only-snippets/ffi.test.js
@@ -11,6 +11,7 @@ import {
toArrayBuffer,
FFIType,
callback,
+ CFunction,
} from "bun:ffi";
it("ffi print", async () => {
@@ -424,6 +425,13 @@ function ffiRunner(types) {
expect(identity_ptr(cptr)).toBe(cptr);
const second_ptr = ptr(new Buffer(8));
expect(identity_ptr(second_ptr)).toBe(second_ptr);
+
+ var myCFunction = new CFunction({
+ ptr: return_a_function_ptr_to_function_that_returns_true(),
+ returns: "bool",
+ });
+ expect(myCFunction()).toBe(true);
+
// function identityBool() {
// return true;
// }
@@ -436,7 +444,7 @@ function ffiRunner(types) {
// identityBool
// );
// expect(
- // cb_identity_true(return_a_function_ptr_to_function_that_returns_true())
+ // cb_identity_true()
// ).toBe(true);
// expect(cb_identity_true(first)).toBe(true);