2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2022-10-05 10:06:44 -04:00
|
|
|
|
|
|
|
import { assertEquals, loadTestLibrary } from "./common.js";
|
|
|
|
|
|
|
|
const objectWrap = loadTestLibrary();
|
|
|
|
|
|
|
|
Deno.test("napi object wrap new", function () {
|
|
|
|
const obj = new objectWrap.NapiObject(0);
|
|
|
|
assertEquals(obj.get_value(), 0);
|
|
|
|
obj.set_value(10);
|
|
|
|
assertEquals(obj.get_value(), 10);
|
|
|
|
obj.increment();
|
|
|
|
assertEquals(obj.get_value(), 11);
|
|
|
|
obj.increment();
|
|
|
|
obj.set_value(10);
|
|
|
|
assertEquals(obj.get_value(), 10);
|
2023-01-10 09:35:46 -05:00
|
|
|
assertEquals(objectWrap.NapiObject.factory(), 64);
|
2022-10-05 10:06:44 -04:00
|
|
|
});
|