Skip to content

Commit bedca2e

Browse files
proppyry
authored andcommitted
add tests for console.log arguments handling
1 parent a834d93 commit bedca2e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/simple/test-console.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
common = require("../common");
2+
assert = common.assert;
3+
4+
var stdout_write = global.process.stdout.write;
5+
var strings = [];
6+
global.process.stdout.write = function(string) {
7+
strings.push(string);
8+
};
9+
10+
console.log('foo');
11+
console.log('foo', 'bar');
12+
console.log('%s %s', 'foo', 'bar', 'hop');
13+
14+
global.process.stdout.write = stdout_write;
15+
assert.equal('foo\n', strings.shift());
16+
assert.equal('foo bar\n', strings.shift());
17+
assert.equal('foo bar hop\n', strings.shift());

0 commit comments

Comments
 (0)