11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Flags: --expose-gc 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst addon = require(`./build/${common.buildType}/8_passing_wrapped`); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciasync function runTest() { 91cb0ef41Sopenharmony_ci let obj1 = addon.createObject(10); 101cb0ef41Sopenharmony_ci let obj2 = addon.createObject(20); 111cb0ef41Sopenharmony_ci const result = addon.add(obj1, obj2); 121cb0ef41Sopenharmony_ci assert.strictEqual(result, 30); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ci // Make sure the native destructor gets called. 151cb0ef41Sopenharmony_ci obj1 = null; 161cb0ef41Sopenharmony_ci obj2 = null; 171cb0ef41Sopenharmony_ci await common.gcUntil('8_passing_wrapped', 181cb0ef41Sopenharmony_ci () => (addon.finalizeCount() === 2)); 191cb0ef41Sopenharmony_ci} 201cb0ef41Sopenharmony_cirunTest(); 21