Browse Source

test: make repl-autolibs check that the callback was invoked

v0.9.1-release
Nathan Rajlich 13 years ago
parent
commit
8752ceef13
  1. 8
      test/simple/test-repl-autolibs.js

8
test/simple/test-repl-autolibs.js

@ -44,7 +44,9 @@ var testMe = repl.start('', putIn, null, true);
test1();
function test1(){
var gotWrite = false;
putIn.write = function (data) {
gotWrite = true;
if (data.length) {
// inspect output matches repl output
assert.equal(data, util.inspect(require('fs'), null, null, false) + '\n');
@ -53,11 +55,15 @@ function test1(){
test2();
}
};
assert(!gotWrite);
putIn.run(['fs']);
assert(gotWrite);
}
function test2(){
var gotWrite = false;
putIn.write = function(data) {
gotWrite = true;
if (data.length) {
// repl response error message
assert.equal(data.indexOf('A different'), 0);
@ -67,5 +73,7 @@ function test2(){
};
var val = {};
global.url = val;
assert(!gotWrite);
putIn.run(['url']);
assert(gotWrite);
}

Loading…
Cancel
Save