summaryrefslogtreecommitdiff
path: root/test/addons
diff options
context:
space:
mode:
authormpark86 <parkm86@gmail.com>2019-10-22 16:40:46 -0400
committerRich Trott <rtrott@gmail.com>2019-10-25 13:29:50 -0700
commit175c318bc18beb8643fa9948a117cdef84f518e0 (patch)
tree9792af5e7d51c2b017437f0609c594e7957cc27a /test/addons
parentd1d571e089e69bc9e3ae525012f6ec00da3a0ab8 (diff)
downloadandroid-node-v8-175c318bc18beb8643fa9948a117cdef84f518e0.tar.gz
android-node-v8-175c318bc18beb8643fa9948a117cdef84f518e0.tar.bz2
android-node-v8-175c318bc18beb8643fa9948a117cdef84f518e0.zip
test: use arrow functions for callbacks
Use arrow functions for callbacks in test/addons/make-callback-recurse/test.js. PR-URL: https://github.com/nodejs/node/pull/30069 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'test/addons')
-rw-r--r--test/addons/make-callback-recurse/test.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js
index 102890cc96..a93a0a4e01 100644
--- a/test/addons/make-callback-recurse/test.js
+++ b/test/addons/make-callback-recurse/test.js
@@ -10,8 +10,8 @@ const makeCallback = binding.makeCallback;
const mustCallCheckDomains = common.mustCall(checkDomains);
// Make sure that using MakeCallback allows the error to propagate.
-assert.throws(function() {
- makeCallback({}, function() {
+assert.throws(() => {
+ makeCallback({}, () => {
throw new Error('hi from domain error');
});
}, /^Error: hi from domain error$/);
@@ -27,22 +27,22 @@ assert.throws(function() {
// Processing of the MicrotaskQueue is manually handled by node. They are not
// processed until after the nextTickQueue has been processed.
- Promise.resolve(1).then(common.mustCall(function() {
+ Promise.resolve(1).then(common.mustCall(() => {
results.push(7);
}));
// The nextTick should run after all immediately invoked calls.
- process.nextTick(common.mustCall(function() {
+ process.nextTick(common.mustCall(() => {
results.push(3);
// Run same test again but while processing the nextTickQueue to make sure
// the following MakeCallback call breaks in the middle of processing the
// queue and allows the script to run normally.
- process.nextTick(common.mustCall(function() {
+ process.nextTick(common.mustCall(() => {
results.push(6);
}));
- makeCallback({}, common.mustCall(function() {
+ makeCallback({}, common.mustCall(() => {
results.push(4);
}));
@@ -54,7 +54,7 @@ assert.throws(function() {
// MakeCallback is calling the function immediately, but should then detect
// that a script is already in the middle of execution and return before
// either the nextTickQueue or MicrotaskQueue are processed.
- makeCallback({}, common.mustCall(function() {
+ makeCallback({}, common.mustCall(() => {
results.push(1);
}));
@@ -63,7 +63,7 @@ assert.throws(function() {
// and process them immediately.
results.push(2);
- setImmediate(common.mustCall(function() {
+ setImmediate(common.mustCall(() => {
for (let i = 0; i < results.length; i++) {
assert.strictEqual(results[i], i,
`verifyExecutionOrder(${arg}) results: ${results}`);
@@ -72,14 +72,14 @@ assert.throws(function() {
// The tests are first run on bootstrap during LoadEnvironment() in
// src/node.cc. Now run the tests through node::MakeCallback().
setImmediate(function() {
- makeCallback({}, common.mustCall(function() {
+ makeCallback({}, common.mustCall(() => {
verifyExecutionOrder(2);
}));
});
} else if (arg === 2) {
// Make sure there are no conflicts using node::MakeCallback()
// within timers.
- setTimeout(common.mustCall(function() {
+ setTimeout(common.mustCall(() => {
verifyExecutionOrder(3);
}), 10);
} else if (arg === 3) {
@@ -94,16 +94,16 @@ assert.throws(function() {
function checkDomains() {
// Check that domains are properly entered/exited when called in multiple
// levels from both node::MakeCallback() and AsyncWrap::MakeCallback
- setImmediate(common.mustCall(function() {
+ setImmediate(common.mustCall(() => {
const d1 = domain.create();
const d2 = domain.create();
const d3 = domain.create();
- makeCallback({ domain: d1 }, common.mustCall(function() {
+ makeCallback({ domain: d1 }, common.mustCall(() => {
assert.strictEqual(d1, process.domain);
- makeCallback({ domain: d2 }, common.mustCall(function() {
+ makeCallback({ domain: d2 }, common.mustCall(() => {
assert.strictEqual(d2, process.domain);
- makeCallback({ domain: d3 }, common.mustCall(function() {
+ makeCallback({ domain: d3 }, common.mustCall(() => {
assert.strictEqual(d3, process.domain);
}));
assert.strictEqual(d2, process.domain);
@@ -112,16 +112,16 @@ function checkDomains() {
}));
}));
- setTimeout(common.mustCall(function() {
+ setTimeout(common.mustCall(() => {
const d1 = domain.create();
const d2 = domain.create();
const d3 = domain.create();
- makeCallback({ domain: d1 }, common.mustCall(function() {
+ makeCallback({ domain: d1 }, common.mustCall(() => {
assert.strictEqual(d1, process.domain);
- makeCallback({ domain: d2 }, common.mustCall(function() {
+ makeCallback({ domain: d2 }, common.mustCall(() => {
assert.strictEqual(d2, process.domain);
- makeCallback({ domain: d3 }, common.mustCall(function() {
+ makeCallback({ domain: d3 }, common.mustCall(() => {
assert.strictEqual(d3, process.domain);
}));
assert.strictEqual(d2, process.domain);
@@ -134,10 +134,10 @@ function checkDomains() {
// Make sure nextTick, setImmediate and setTimeout can all recover properly
// after a thrown makeCallback call.
const d = domain.create();
- d.on('error', common.mustCall(function(e) {
+ d.on('error', common.mustCall((e) => {
assert.strictEqual(e.message, `throw from domain ${id}`);
}));
- makeCallback({ domain: d }, function() {
+ makeCallback({ domain: d }, () => {
throw new Error(`throw from domain ${id}`);
});
throw new Error('UNREACHABLE');