diff options
author | Sakthipriyan Vairamani <thechargingvolcano@gmail.com> | 2016-06-26 12:04:31 +0530 |
---|---|---|
committer | Sakthipriyan Vairamani <thechargingvolcano@gmail.com> | 2016-07-22 02:34:01 +0530 |
commit | 9359de9dd2eae06ed5afcb75dad9bd4c466eb69d (patch) | |
tree | 1f5c1845a1413989f89f41460bba31b30b7bc3e5 /test/parallel/test-fs-mkdtemp.js | |
parent | 9983af03470a89cc925781279be40898efae3f31 (diff) | |
download | android-node-v8-9359de9dd2eae06ed5afcb75dad9bd4c466eb69d.tar.gz android-node-v8-9359de9dd2eae06ed5afcb75dad9bd4c466eb69d.tar.bz2 android-node-v8-9359de9dd2eae06ed5afcb75dad9bd4c466eb69d.zip |
fs: make callback mandatory to all async functions
The "fs" module has two functions called `maybeCallback` and
`makeCallback`, as of now.
The `maybeCallback` creates a default function to report errors, if the
parameter passed is not a function object. Basically, if the callback
is omitted in some cases, this function is used to create a default
callback function.
The `makeCallback`, OTOH, creates a default function only if the
parameter passed is `undefined`, and if it is not a function object it
will throw an `Error`.
This patch removes the `maybeCallback` function and makes the callback
function argument mandatory for all the async functions.
PR-URL: https://github.com/nodejs/node/pull/7168
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-mkdtemp.js')
-rw-r--r-- | test/parallel/test-fs-mkdtemp.js | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/test/parallel/test-fs-mkdtemp.js b/test/parallel/test-fs-mkdtemp.js index dd4ab75c22..60d1196c5a 100644 --- a/test/parallel/test-fs-mkdtemp.js +++ b/test/parallel/test-fs-mkdtemp.js @@ -29,8 +29,3 @@ fs.mkdtemp(path.join(common.tmpDir, 'bar.'), common.mustCall(handler)); // Same test as above, but making sure that passing an options object doesn't // affect the way the callback function is handled. fs.mkdtemp(path.join(common.tmpDir, 'bar.'), {}, common.mustCall(handler)); - -// Making sure that not passing a callback doesn't crash, as a default function -// is passed internally. -assert.doesNotThrow(() => fs.mkdtemp(path.join(common.tmpDir, 'bar-'))); -assert.doesNotThrow(() => fs.mkdtemp(path.join(common.tmpDir, 'bar-'), {})); |