MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / TestCBInfoSetData

Class TestCBInfoSetData

test/callbackInfo.cc:5–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3using namespace Napi;
4
5struct TestCBInfoSetData {
6 static void Test(napi_env env, napi_callback_info info) {
7 Napi::CallbackInfo cbInfo(env, info);
8 int valuePointer = 1220202;
9 cbInfo.SetData(&valuePointer);
10
11 int* placeHolder = static_cast<int*>(cbInfo.Data());
12 assert(*(placeHolder) == valuePointer);
13 assert(placeHolder == &valuePointer);
14 }
15};
16
17void TestCallbackInfoSetData(const Napi::CallbackInfo& info) {
18 napi_callback_info cb_info = static_cast<napi_callback_info>(info);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected