xref: /third_party/node/test/js-native-api/3_callbacks/test.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/js-native-api/3_callbacks/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ciconst addon = require(`./build/${common.buildType}/3_callbacks`);
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciaddon.RunCallback(function(msg) {
71cb0ef41Sopenharmony_ci  assert.strictEqual(msg, 'hello world');
81cb0ef41Sopenharmony_ci});
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cifunction testRecv(desiredRecv) {
111cb0ef41Sopenharmony_ci  addon.RunCallbackWithRecv(function() {
121cb0ef41Sopenharmony_ci    assert.strictEqual(this, desiredRecv);
131cb0ef41Sopenharmony_ci  }, desiredRecv);
141cb0ef41Sopenharmony_ci}
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_citestRecv(undefined);
171cb0ef41Sopenharmony_citestRecv(null);
181cb0ef41Sopenharmony_citestRecv(5);
191cb0ef41Sopenharmony_citestRecv(true);
201cb0ef41Sopenharmony_citestRecv('Hello');
211cb0ef41Sopenharmony_citestRecv([]);
221cb0ef41Sopenharmony_citestRecv({});
23

Indexes created Thu Nov 07 10:32:03 CST 2024