|
| 1 | +#include "napi.h" |
| 2 | + |
| 3 | +using namespace Napi; |
| 4 | + |
| 5 | +// Wrappers for testing Object::Get() for global Objects |
| 6 | +Value GetPropertyWithCppStyleStringAsKey(const CallbackInfo& info); |
| 7 | +Value GetPropertyWithCStyleStringAsKey(const CallbackInfo& info); |
| 8 | +Value GetPropertyWithInt32AsKey(const CallbackInfo& info); |
| 9 | +Value GetPropertyWithNapiValueAsKey(const CallbackInfo& info); |
| 10 | +void CreateMockTestObject(const CallbackInfo& info); |
| 11 | + |
| 12 | +// Wrapper for testing Object::Set() for global Objects |
| 13 | +void SetPropertyWithCStyleStringAsKey(const CallbackInfo& info); |
| 14 | +void SetPropertyWithCppStyleStringAsKey(const CallbackInfo& info); |
| 15 | +void SetPropertyWithInt32AsKey(const CallbackInfo& info); |
| 16 | +void SetPropertyWithNapiValueAsKey(const CallbackInfo& info); |
| 17 | + |
| 18 | +Value HasPropertyWithCStyleStringAsKey(const CallbackInfo& info); |
| 19 | +Value HasPropertyWithCppStyleStringAsKey(const CallbackInfo& info); |
| 20 | +Value HasPropertyWithNapiValueAsKey(const CallbackInfo& info); |
| 21 | + |
| 22 | +Value DeletePropertyWithCStyleStringAsKey(const CallbackInfo& info); |
| 23 | +Value DeletePropertyWithCppStyleStringAsKey(const CallbackInfo& info); |
| 24 | +Value DeletePropertyWithInt32AsKey(const CallbackInfo& info); |
| 25 | +Value DeletePropertyWithNapiValueAsKey(const CallbackInfo& info); |
| 26 | + |
| 27 | +Object InitGlobalObject(Env env) { |
| 28 | + Object exports = Object::New(env); |
| 29 | + exports["getPropertyWithInt32"] = |
| 30 | + Function::New(env, GetPropertyWithInt32AsKey); |
| 31 | + exports["getPropertyWithNapiValue"] = |
| 32 | + Function::New(env, GetPropertyWithNapiValueAsKey); |
| 33 | + exports["getPropertyWithCppString"] = |
| 34 | + Function::New(env, GetPropertyWithCppStyleStringAsKey); |
| 35 | + exports["getPropertyWithCString"] = |
| 36 | + Function::New(env, GetPropertyWithCStyleStringAsKey); |
| 37 | + exports["createMockTestObject"] = Function::New(env, CreateMockTestObject); |
| 38 | + exports["setPropertyWithCStyleString"] = |
| 39 | + Function::New(env, SetPropertyWithCStyleStringAsKey); |
| 40 | + exports["setPropertyWithCppStyleString"] = |
| 41 | + Function::New(env, SetPropertyWithCppStyleStringAsKey); |
| 42 | + exports["setPropertyWithNapiValue"] = |
| 43 | + Function::New(env, SetPropertyWithNapiValueAsKey); |
| 44 | + exports["setPropertyWithInt32"] = |
| 45 | + Function::New(env, SetPropertyWithInt32AsKey); |
| 46 | + exports["hasPropertyWithCStyleString"] = |
| 47 | + Function::New(env, HasPropertyWithCStyleStringAsKey); |
| 48 | + exports["hasPropertyWithCppStyleString"] = |
| 49 | + Function::New(env, HasPropertyWithCppStyleStringAsKey); |
| 50 | + exports["hasPropertyWithNapiValue"] = |
| 51 | + Function::New(env, HasPropertyWithNapiValueAsKey); |
| 52 | + exports["deletePropertyWithCStyleString"] = |
| 53 | + Function::New(env, DeletePropertyWithCStyleStringAsKey); |
| 54 | + exports["deletePropertyWithCppStyleString"] = |
| 55 | + Function::New(env, DeletePropertyWithCppStyleStringAsKey); |
| 56 | + exports["deletePropertyWithInt32"] = |
| 57 | + Function::New(env, DeletePropertyWithInt32AsKey); |
| 58 | + exports["deletePropertyWithNapiValue"] = |
| 59 | + Function::New(env, DeletePropertyWithNapiValueAsKey); |
| 60 | + return exports; |
| 61 | +} |
0 commit comments