mirror of https://github.com/lukechilds/node.git
Ryan Dahl
15 years ago
5 changed files with 126 additions and 1 deletions
@ -0,0 +1,38 @@ |
|||||
|
include("mjsunit.js"); |
||||
|
|
||||
|
success_count = 0; |
||||
|
error_count = 0; |
||||
|
|
||||
|
node.exec("ls /").addCallback(function (out) { |
||||
|
success_count++; |
||||
|
p(out); |
||||
|
}).addErrback(function (code, out, err) { |
||||
|
error_count++; |
||||
|
puts("error!: " + code); |
||||
|
puts("stdout: " + JSON.stringify(out)); |
||||
|
puts("stderr: " + JSON.stringify(err)); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
node.exec("ls /DOES_NOT_EXIST").addCallback(function (out) { |
||||
|
success_count++; |
||||
|
p(out); |
||||
|
assertTrue(out != ""); |
||||
|
|
||||
|
}).addErrback(function (code, out, err) { |
||||
|
error_count++; |
||||
|
|
||||
|
assertEquals("", out); |
||||
|
assertTrue(code != 0); |
||||
|
|
||||
|
puts("error!: " + code); |
||||
|
puts("stdout: " + JSON.stringify(out)); |
||||
|
puts("stderr: " + JSON.stringify(err)); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
process.addListener("exit", function () { |
||||
|
assertEquals(1, success_count); |
||||
|
assertEquals(1, error_count); |
||||
|
}); |
Loading…
Reference in new issue