2010-02-25 14:36:17 +08:00
|
|
|
process.mixin(require("../common"));
|
2010-03-09 02:02:19 +08:00
|
|
|
var path = require('path');
|
2010-02-08 10:05:58 +08:00
|
|
|
|
|
|
|
var sub = path.join(fixturesDir, 'print-chars.js');
|
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
n = 100000;
|
2010-02-08 10:05:58 +08:00
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
var child = process.createChildProcess(process.argv[0], [sub, n]);
|
2010-02-08 10:05:58 +08:00
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
var count = 0;
|
2010-02-08 10:05:58 +08:00
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
child.addListener("error", function (data){
|
|
|
|
if (data) {
|
|
|
|
puts("parent stderr: " + data);
|
|
|
|
assert.ok(false);
|
|
|
|
}
|
2010-02-08 10:05:58 +08:00
|
|
|
});
|
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
child.addListener("output", function (data){
|
|
|
|
if (data) {
|
|
|
|
count += data.length;
|
|
|
|
puts(count);
|
|
|
|
}
|
|
|
|
});
|
2010-02-08 10:05:58 +08:00
|
|
|
|
2010-02-08 13:56:36 +08:00
|
|
|
child.addListener("exit", function (data) {
|
|
|
|
assert.equal(n, count);
|
|
|
|
puts("okay");
|
2010-02-08 10:05:58 +08:00
|
|
|
});
|