| 25 | static void TestSetter(const Napi::CallbackInfo& /*info*/) {} |
| 26 | |
| 27 | class TestClass : public Napi::ObjectWrap<TestClass> { |
| 28 | public: |
| 29 | TestClass(const Napi::CallbackInfo& info) : ObjectWrap<TestClass>(info) {} |
| 30 | static Napi::Value TestClassStaticMethod(const Napi::CallbackInfo& info) { |
| 31 | return Napi::Number::New(info.Env(), 42); |
| 32 | } |
| 33 | |
| 34 | static void TestClassStaticVoidMethod(const Napi::CallbackInfo& /*info*/) {} |
| 35 | |
| 36 | Napi::Value TestClassInstanceMethod(const Napi::CallbackInfo& info) { |
| 37 | return Napi::Number::New(info.Env(), 42); |
| 38 | } |
| 39 | |
| 40 | void TestClassInstanceVoidMethod(const Napi::CallbackInfo& /*info*/) {} |
| 41 | |
| 42 | Napi::Value TestClassInstanceGetter(const Napi::CallbackInfo& info) { |
| 43 | return Napi::Number::New(info.Env(), 42); |
| 44 | } |
| 45 | |
| 46 | void TestClassInstanceSetter(const Napi::CallbackInfo& /*info*/, |
| 47 | const Napi::Value& /*new_value*/) {} |
| 48 | |
| 49 | static Napi::Function NewClass(Napi::Env env) { |
| 50 | return DefineClass( |
| 51 | env, |
| 52 | "TestClass", |
| 53 | {// Make sure to check that the deleter gets called. |
| 54 | StaticMethod("staticMethod", TestClassStaticMethod), |
| 55 | // Make sure to check that the deleter gets called. |
| 56 | StaticMethod("staticVoidMethod", TestClassStaticVoidMethod), |
| 57 | // Make sure to check that the deleter gets called. |
| 58 | StaticMethod(Napi::Symbol::New(env, "staticMethod"), |
| 59 | TestClassStaticMethod), |
| 60 | // Make sure to check that the deleter gets called. |
| 61 | StaticMethod(Napi::Symbol::New(env, "staticVoidMethod"), |
| 62 | TestClassStaticVoidMethod), |
| 63 | // Make sure to check that the deleter gets called. |
| 64 | InstanceMethod("instanceMethod", &TestClass::TestClassInstanceMethod), |
| 65 | // Make sure to check that the deleter gets called. |
| 66 | InstanceMethod("instanceVoidMethod", |
| 67 | &TestClass::TestClassInstanceVoidMethod), |
| 68 | // Make sure to check that the deleter gets called. |
| 69 | InstanceMethod(Napi::Symbol::New(env, "instanceMethod"), |
| 70 | &TestClass::TestClassInstanceMethod), |
| 71 | // Make sure to check that the deleter gets called. |
| 72 | InstanceMethod(Napi::Symbol::New(env, "instanceVoidMethod"), |
| 73 | &TestClass::TestClassInstanceVoidMethod), |
| 74 | // Make sure to check that the deleter gets called. |
| 75 | InstanceAccessor("instanceAccessor", |
| 76 | &TestClass::TestClassInstanceGetter, |
| 77 | &TestClass::TestClassInstanceSetter)}); |
| 78 | } |
| 79 | }; |
| 80 | |
| 81 | static Napi::Value CreateTestObject(const Napi::CallbackInfo& info) { |
| 82 | Napi::Env env = info.Env(); |
nothing calls this directly
no outgoing calls
no test coverage detected