From d062327a5dc6375f9bdaf8ec3bf41c9dba3d7c92 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Sun, 19 Feb 2017 18:30:15 +0100 Subject: [PATCH 1/6] test: add regex to match error message --- test/parallel/test-fs-realpath.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 331cec5ee8c8bb..8bd492b3350c42 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,9 +201,11 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }); + assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP: too many/); asynctest(fs.realpath, [entry], callback, function(err, result) { - assert.ok(err && true); + assert.ok(err.code === 'ELOOP'); + assert.ok(err.path === entry); + assert.ok(result === undefined); return true; }); } From 38ad8d720fbe1a2443178495efe93fed47b11664 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Wed, 22 Feb 2017 08:39:06 +0100 Subject: [PATCH 2/6] test: lint error correction --- test/parallel/test-fs-realpath.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 8bd492b3350c42..73dbc3972596e0 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,10 +201,10 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP: too many/); + assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP/); asynctest(fs.realpath, [entry], callback, function(err, result) { assert.ok(err.code === 'ELOOP'); - assert.ok(err.path === entry); + assert.ok(err.path === entry); assert.ok(result === undefined); return true; }); From 3dd9731ee198916843e0dbe1efbd40183004ae91 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Sun, 19 Feb 2017 18:30:15 +0100 Subject: [PATCH 3/6] test: add regex to match error message --- test/parallel/test-fs-realpath.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 73dbc3972596e0..8bd492b3350c42 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,10 +201,10 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP/); + assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP: too many/); asynctest(fs.realpath, [entry], callback, function(err, result) { assert.ok(err.code === 'ELOOP'); - assert.ok(err.path === entry); + assert.ok(err.path === entry); assert.ok(result === undefined); return true; }); From 77fb1b37c5d561b00c1d94c7824b5802a0e6cbb7 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Wed, 22 Feb 2017 08:39:06 +0100 Subject: [PATCH 4/6] test: lint error correction --- test/parallel/test-fs-realpath.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 8bd492b3350c42..73dbc3972596e0 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,10 +201,10 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP: too many/); + assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP/); asynctest(fs.realpath, [entry], callback, function(err, result) { assert.ok(err.code === 'ELOOP'); - assert.ok(err.path === entry); + assert.ok(err.path === entry); assert.ok(result === undefined); return true; }); From 4370eb51eb5e8ba1c31bfdd580bce139203dd2e8 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Sat, 25 Feb 2017 12:48:19 +0100 Subject: [PATCH 5/6] test: test assertions improvements --- test/parallel/test-fs-realpath.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 73dbc3972596e0..387ea467d8eb6f 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -201,13 +201,15 @@ function test_cyclic_link_protection(callback) { fs.symlinkSync(t[1], t[0], 'dir'); unlink.push(t[0]); }); - assert.throws(function() { fs.realpathSync(entry); }, /^Error: ELOOP/); - asynctest(fs.realpath, [entry], callback, function(err, result) { - assert.ok(err.code === 'ELOOP'); - assert.ok(err.path === entry); - assert.ok(result === undefined); - return true; - }); + assert.throws(() => { + fs.realpathSync(entry); + }, common.expectsError('ELOOP', Error)); + asynctest( + fs.realpath, [entry], callback, common.mustCall(function(err, result) { + assert.ok(err.path === entry); + assert.ok(result === undefined); + return true; + })); } function test_cyclic_link_overprotection(callback) { From 1130abd07bca2fe056bb7b384cace3c51f120192 Mon Sep 17 00:00:00 2001 From: Clarence Dimitri CHARLES Date: Tue, 28 Feb 2017 02:26:14 +0100 Subject: [PATCH 6/6] test: update the call of the function common.expectsError --- test/parallel/test-fs-realpath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index 387ea467d8eb6f..1e8c701d4343db 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -203,7 +203,7 @@ function test_cyclic_link_protection(callback) { }); assert.throws(() => { fs.realpathSync(entry); - }, common.expectsError('ELOOP', Error)); + }, common.expectsError({ code: 'ELOOP', type: Error })); asynctest( fs.realpath, [entry], callback, common.mustCall(function(err, result) { assert.ok(err.path === entry);