test: add mustCall to test-fs-readfile-pipe
PR-URL: https://github.com/nodejs/node/pull/27450 Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
73a686f1bb
commit
fa3714d721
@ -31,10 +31,10 @@ const assert = require('assert');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
if (process.argv[2] === 'child') {
|
if (process.argv[2] === 'child') {
|
||||||
fs.readFile('/dev/stdin', function(er, data) {
|
fs.readFile('/dev/stdin', common.mustCall(function(er, data) {
|
||||||
assert.ifError(er);
|
assert.ifError(er);
|
||||||
process.stdout.write(data);
|
process.stdout.write(data);
|
||||||
});
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ const exec = require('child_process').exec;
|
|||||||
const f = JSON.stringify(__filename);
|
const f = JSON.stringify(__filename);
|
||||||
const node = JSON.stringify(process.execPath);
|
const node = JSON.stringify(process.execPath);
|
||||||
const cmd = `cat ${filename} | ${node} ${f} child`;
|
const cmd = `cat ${filename} | ${node} ${f} child`;
|
||||||
exec(cmd, function(err, stdout, stderr) {
|
exec(cmd, common.mustCall(function(err, stdout, stderr) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
stdout,
|
stdout,
|
||||||
@ -58,4 +58,4 @@ exec(cmd, function(err, stdout, stderr) {
|
|||||||
'',
|
'',
|
||||||
`expected not to read anything from stderr but got: '${stderr}'`);
|
`expected not to read anything from stderr but got: '${stderr}'`);
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
});
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user