diff options
author | RobotMermaid <ondinerangel@gmail.com> | 2017-04-22 13:22:16 -0700 |
---|---|---|
committer | Evan Lucas <evanlucas@me.com> | 2017-05-02 15:22:45 -0500 |
commit | 75e053be39726e78af7f63b8e413c1c06fc32e13 (patch) | |
tree | b6a1a7cc9cb765f2db9002dab6964a3e15b2b198 | |
parent | 212475b451386a6705b4ea2c047ce948efe4799d (diff) | |
download | node-new-75e053be39726e78af7f63b8e413c1c06fc32e13.tar.gz |
test: cleanup test-util-inherits.js
Replaced constructor with regular expression for assert.throw().
PR-URL: https://github.com/nodejs/node/pull/12602
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r-- | test/parallel/test-util-inherits.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js index a3c5786fe2..4ddf9ad35d 100644 --- a/test/parallel/test-util-inherits.js +++ b/test/parallel/test-util-inherits.js @@ -3,6 +3,10 @@ require('../common'); const assert = require('assert'); const inherits = require('util').inherits; +const errCheck = + new RegExp('^TypeError: The super constructor to "inherits" must not be ' + + 'null or undefined$'); + // super constructor function A() { @@ -75,6 +79,12 @@ assert.strictEqual(e.e(), 'e'); assert.strictEqual(e.constructor, E); // should throw with invalid arguments -assert.throws(function() { inherits(A, {}); }, TypeError); -assert.throws(function() { inherits(A, null); }, TypeError); -assert.throws(function() { inherits(null, A); }, TypeError); +assert.throws(function() { + inherits(A, {}); +}, /^TypeError: The super constructor to "inherits" must have a prototype$/); +assert.throws(function() { + inherits(A, null); +}, errCheck); +assert.throws(function() { + inherits(null, A); +}, /^TypeError: The constructor to "inherits" must not be null or undefined$/); |