summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-non-number-arguments-throw.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2016-11-29 20:28:08 +0100
committerMichaël Zasso <targos@protonmail.com>2016-12-02 13:16:40 +0100
commitde495c0669345892beb6d9f025e9a9b7b6a59df1 (patch)
tree8d5ee7c824437590f00d89df24054211fc5a7d1a /test/parallel/test-fs-non-number-arguments-throw.js
parent24a98dd810d0713d736fb82aec284773b855064e (diff)
downloadandroid-node-v8-de495c0669345892beb6d9f025e9a9b7b6a59df1.tar.gz
android-node-v8-de495c0669345892beb6d9f025e9a9b7b6a59df1.tar.bz2
android-node-v8-de495c0669345892beb6d9f025e9a9b7b6a59df1.zip
test: refactor test-fs-non-number-arguments-throw
* Add RegExp arguments to throws assertions. * Use common.mustCall for emitter callback. PR-URL: https://github.com/nodejs/node/pull/9844 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-non-number-arguments-throw.js')
-rw-r--r--test/parallel/test-fs-non-number-arguments-throw.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/parallel/test-fs-non-number-arguments-throw.js b/test/parallel/test-fs-non-number-arguments-throw.js
index 8f34a1fcbb..b13041ca3e 100644
--- a/test/parallel/test-fs-non-number-arguments-throw.js
+++ b/test/parallel/test-fs-non-number-arguments-throw.js
@@ -15,17 +15,20 @@ const saneEmitter = fs.createReadStream(tempFile, { start: 4, end: 6 });
assert.throws(function() {
fs.createReadStream(tempFile, { start: '4', end: 6 });
-}, "start as string didn't throw an error for createReadStream");
+}, /^TypeError: "start" option must be a Number$/,
+ "start as string didn't throw an error for createReadStream");
assert.throws(function() {
fs.createReadStream(tempFile, { start: 4, end: '6' });
-}, "end as string didn't throw an error");
+}, /^TypeError: "end" option must be a Number$/,
+ "end as string didn't throw an error for createReadStream");
assert.throws(function() {
fs.createWriteStream(tempFile, { start: '4' });
-}, "start as string didn't throw an error for createWriteStream");
+}, /^TypeError: "start" option must be a Number$/,
+ "start as string didn't throw an error for createWriteStream");
-saneEmitter.on('data', function(data) {
+saneEmitter.on('data', common.mustCall(function(data) {
assert.strictEqual(sanity, data.toString('utf8'), 'read ' +
data.toString('utf8') + ' instead of ' + sanity);
-});
+}));