Commit Graph

5 Commits

Author SHA1 Message Date
Octavian Soldea
db1c4a7592 n-api: refactor a previous commit
This is a refactoring of https://github.com/nodejs/node/issues/27628
following https://github.com/nodejs/node/pull/28505.

This change factors out functions `add_last_status()` and
`add_returned_status()` so they may be reused in the tests for passing
information about the last error status and/or a returned `napi_status`
to JavaScript.

PR-URL: https://github.com/nodejs/node/pull/28848
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
2019-07-26 15:09:04 -07:00
Octavian Soldea
ddbaddcce1 test: pass null params to napi_xxx_property()
For napi_set_property(), each one of the following arguments is checked:
      napi_env env,
      napi_value object,
      napi_value key,
      napi_value* value.

    For napi_has_property(), each one of the following arguments is checked:

      napi_env env,
      napi_value object,
      napi_value key,
      bool* result

    For napi_get_property, each one of the following arguments is checked:

      napi_env env,
      napi_value object,
      napi_value key,
      napi_value* result

PR-URL: https://github.com/nodejs/node/pull/27628
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-13 16:27:13 -07:00
Anna Henningsen
5c08481aa7 n-api: make napi_get_property_names return strings
The documentation says that this method returns an array of strings.
Currently, it does not do so for indices. Resolve that by telling
V8 explicitly to convert to string.

PR-URL: https://github.com/nodejs/node/pull/27524
Fixes: https://github.com/nodejs/node/issues/27496
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-05-06 05:12:27 +02:00
Gabriel Schulhof
baa54a5ae7 test: cover napi_get/set/has_named_property()
Add test coverage for these N-APIs.

PR-URL: https://github.com/nodejs/node/pull/26947
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2019-04-05 11:56:09 -07:00
Gabriel Schulhof
938e11882b test: partition N-API tests
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.

PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-12-04 13:58:17 -08:00