summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-06-25 16:25:48 +0200
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-06-28 04:56:34 +0200
commitd11b5382d69bf299760d88b7209b3b6b27ae4104 (patch)
tree8da4cdb7e9c202949a5456d8455f6d59e92e1c84 /test
parent6045fbbb5ee970809c92569e201895ef6345ed48 (diff)
downloadandroid-node-v8-d11b5382d69bf299760d88b7209b3b6b27ae4104.tar.gz
android-node-v8-d11b5382d69bf299760d88b7209b3b6b27ae4104.tar.bz2
android-node-v8-d11b5382d69bf299760d88b7209b3b6b27ae4104.zip
test: use assert() in N-API async test
The `Execute()` callback is not allowed to call into JS, so we should use `assert()` instead of potentially throwing JS errors. PR-URL: https://github.com/nodejs/node/pull/28423 Fixes: https://github.com/nodejs/help/issues/1998 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test')
-rw-r--r--test/node-api/test_async/test_async.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/test/node-api/test_async/test_async.cc b/test/node-api/test_async/test_async.cc
index 49db7aa66f..ff3d2749a9 100644
--- a/test/node-api/test_async/test_async.cc
+++ b/test/node-api/test_async/test_async.cc
@@ -1,3 +1,4 @@
+#include <assert.h>
#include <stdio.h>
#include <node_api.h>
#include "../../js-native-api/common.h"
@@ -29,10 +30,7 @@ void Execute(napi_env env, void* data) {
#endif
carrier* c = static_cast<carrier*>(data);
- if (c != &the_carrier) {
- napi_throw_type_error(env, nullptr, "Wrong data parameter to Execute.");
- return;
- }
+ assert(c == &the_carrier);
c->_output = c->_input * 2;
}