test: improve test-assert.js

Verify error message thrown from assert.ifError

PR-URL: https://github.com/nodejs/node/pull/11193
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
jobala 2017-02-01 20:34:11 +03:00 committed by James M Snell
parent 3d2bd7abda
commit 5f20d62c8f

View File

@ -387,7 +387,8 @@ assert.throws(makeBlock(thrower, TypeError));
'a.doesNotThrow is not catching type matching errors');
}
assert.throws(function() { assert.ifError(new Error('test error')); });
assert.throws(function() { assert.ifError(new Error('test error')); },
/^Error: test error$/);
assert.doesNotThrow(function() { assert.ifError(null); });
assert.doesNotThrow(function() { assert.ifError(); });