test: console constructor missing new keyword

The `console.Console()` constructor function handles a missing `new`
keyword. This code is not exercised in the current tests. Add a test for
this.

PR-URL: https://github.com/nodejs/node/pull/8003
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
Reviewed-By: JacksonTian - Jackson Tian <shvyo1987@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Rich Trott 2016-08-06 21:52:23 -07:00
parent 8726a1c318
commit 4c62892a4b

View File

@ -64,3 +64,8 @@ out.write = function(d) {
};
[1, 2, 3].forEach(c.log);
assert.equal(3, called);
// Console() detects if it is called without `new` keyword
assert.doesNotThrow(function() {
Console(out, err);
});