From 10e7c52a70a8e5c6a817ca47c4c95ecde0c9f663 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sun, 11 Sep 2011 03:52:44 +0200 Subject: [PATCH] win: make test-cli-eval.js pass --- test/simple/test-cli-eval.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/simple/test-cli-eval.js b/test/simple/test-cli-eval.js index 66052e1..a51fded 100644 --- a/test/simple/test-cli-eval.js +++ b/test/simple/test-cli-eval.js @@ -19,13 +19,14 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -// libuv-broken +var common = require('../common.js'), + assert = require('assert'), + child = require('child_process'), + nodejs = '"' + process.execPath + '"'; - -assert = require('assert'); -child = require('child_process'); - -nodejs = '"' + process.execPath + '"'; +// replace \ by / because windows uses backslashes in paths, but they're still +// interpreted as the escape character when put between quotes. +var filename = __filename.replace(/\\/g, '/'); if (module.parent) { // signal we've been loaded as a module @@ -40,13 +41,13 @@ child.exec(nodejs + ' --eval 42', }); // assert that "42\n" is written to stderr -child.exec(nodejs + ' --eval \'console.error(42)\'', +child.exec(nodejs + ' --eval "console.error(42)"', function(err, stdout, stderr) { assert.equal(stderr, "42\n"); }); // assert that module loading works -child.exec(nodejs + ' --eval "require(\'' + __filename + '\')"', +child.exec(nodejs + ' --eval "require(\'' + filename + '\')"', function(status, stdout, stderr) { assert.equal(status.code, 42); }); -- 2.7.4