|
1 | 1 | #include <node_api.h>
|
| 2 | +#include <stdlib.h> |
2 | 3 | #include "../common.h"
|
3 | 4 |
|
4 | 5 | napi_value testStrictEquals(napi_env env, napi_callback_info info) {
|
@@ -215,12 +216,24 @@ napi_value testAdjustExternalMemory(napi_env env, napi_callback_info info) {
|
215 | 216 | return result;
|
216 | 217 | }
|
217 | 218 |
|
| 219 | +napi_value testNapiRun(napi_env env, napi_callback_info info) { |
| 220 | + napi_value script, result; |
| 221 | + size_t argc = 1; |
| 222 | + |
| 223 | + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &script, NULL, NULL)); |
| 224 | + |
| 225 | + NAPI_CALL(env, napi_run_script(env, script, &result)); |
| 226 | + |
| 227 | + return result; |
| 228 | +} |
| 229 | + |
218 | 230 | void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
|
219 | 231 | napi_property_descriptor descriptors[] = {
|
220 | 232 | DECLARE_NAPI_PROPERTY("testStrictEquals", testStrictEquals),
|
221 | 233 | DECLARE_NAPI_PROPERTY("testGetPrototype", testGetPrototype),
|
222 | 234 | DECLARE_NAPI_PROPERTY("testGetVersion", testGetVersion),
|
223 | 235 | DECLARE_NAPI_PROPERTY("testGetNodeVersion", testGetNodeVersion),
|
| 236 | + DECLARE_NAPI_PROPERTY("testNapiRun", testNapiRun), |
224 | 237 | DECLARE_NAPI_PROPERTY("doInstanceOf", doInstanceOf),
|
225 | 238 | DECLARE_NAPI_PROPERTY("getUndefined", getUndefined),
|
226 | 239 | DECLARE_NAPI_PROPERTY("getNull", getNull),
|
|
0 commit comments