diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-05-06 20:22:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 21:22:50 +0200 |
commit | f698bc70e2f1d4cd58d17544258cf1b19726b66a (patch) | |
tree | 7c2ae51caae1b9f832c59a8bf0a0c2300672d68d /tests/napi/object_test.js | |
parent | a635abbf2136f5512543551af6a6c37b5e9aa4ba (diff) |
fix(ext/node): napi_get_element and napi_set_element work with objects (#23713)
This change makes DuckDB example work:
https://github.com/denoland/deno/issues/23656.
Diffstat (limited to 'tests/napi/object_test.js')
-rw-r--r-- | tests/napi/object_test.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/napi/object_test.js b/tests/napi/object_test.js new file mode 100644 index 000000000..4bc5c3c9c --- /dev/null +++ b/tests/napi/object_test.js @@ -0,0 +1,15 @@ +// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. + +import { assert, assertEquals, loadTestLibrary } from "./common.js"; + +const object = loadTestLibrary(); + +Deno.test("napi object", function () { + const r = object.test_object_new(1, "hello"); + assertEquals(typeof r, "object"); + assertEquals(r[0], 1); + assertEquals(r[1], "hello"); + + const r1 = object.test_object_get(r); + assert(r === r1); +}); |