mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
Adding test for bug in stdio.
http://groups.google.com/group/nodejs/browse_thread/thread/10fda8eaf7276642/e5d5147f2b666abd
This commit is contained in:
5
test/mjsunit/fixtures/echo.js
Normal file
5
test/mjsunit/fixtures/echo.js
Normal file
@@ -0,0 +1,5 @@
|
||||
process.mixin(require("../common"));
|
||||
process.stdio.open();
|
||||
process.stdio.addListener("data", function (data) {
|
||||
puts(data);
|
||||
});
|
||||
@@ -7,9 +7,18 @@ puts("readdir " + fixturesDir);
|
||||
|
||||
promise.addCallback(function (files) {
|
||||
p(files);
|
||||
assert.deepEqual(["a.js", "b","cycles", "multipart.js",
|
||||
"nested-index","test_ca.pem",
|
||||
"test_cert.pem", "test_key.pem", "throws_error.js", "x.txt"], files.sort());
|
||||
assert.deepEqual(['a.js'
|
||||
, 'b'
|
||||
, 'cycles'
|
||||
, 'echo.js'
|
||||
, 'multipart.js'
|
||||
, 'nested-index'
|
||||
, 'test_ca.pem'
|
||||
, 'test_cert.pem'
|
||||
, 'test_key.pem'
|
||||
, 'throws_error.js'
|
||||
, 'x.txt'
|
||||
], files.sort());
|
||||
});
|
||||
|
||||
promise.addErrback(function () {
|
||||
|
||||
21
test/mjsunit/test-stdio.js
Normal file
21
test/mjsunit/test-stdio.js
Normal file
@@ -0,0 +1,21 @@
|
||||
process.mixin(require("./common"));
|
||||
|
||||
var sub = path.join(fixturesDir, 'echo.js');
|
||||
|
||||
var result = false;
|
||||
|
||||
var child = process.createChildProcess(path.join(libDir, "../bin/node"), [sub]);
|
||||
child.addListener("error", function (data){
|
||||
puts("parent stderr: " + data);
|
||||
});
|
||||
child.addListener("output", function (data){
|
||||
if (data && data[0] == 't') {
|
||||
result = true;
|
||||
}
|
||||
});
|
||||
setTimeout(function () {
|
||||
child.write('t\r\n');
|
||||
}, 100);
|
||||
setTimeout(function (){
|
||||
assert.ok(result);
|
||||
}, 500)
|
||||
Reference in New Issue
Block a user