From bedca2e7a9714ad97bc12e1228ff08075fd25556 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Tue, 17 Aug 2010 19:07:45 +0200 Subject: [PATCH] add tests for console.log arguments handling --- test/simple/test-console.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/simple/test-console.js diff --git a/test/simple/test-console.js b/test/simple/test-console.js new file mode 100644 index 0000000000..8e25f2877b --- /dev/null +++ b/test/simple/test-console.js @@ -0,0 +1,17 @@ +common = require("../common"); +assert = common.assert; + +var stdout_write = global.process.stdout.write; +var strings = []; +global.process.stdout.write = function(string) { + strings.push(string); +}; + +console.log('foo'); +console.log('foo', 'bar'); +console.log('%s %s', 'foo', 'bar', 'hop'); + +global.process.stdout.write = stdout_write; +assert.equal('foo\n', strings.shift()); +assert.equal('foo bar\n', strings.shift()); +assert.equal('foo bar hop\n', strings.shift());