diff options
| author | ruki <[email protected]> | 2017-05-21 21:42:54 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-21 21:42:54 +0800 |
| commit | 433c76d7735fc8006ab400850e0e08a4e5bffdc0 (patch) | |
| tree | 6f04d49bf8868e5981e5918813c02c461d75b8e1 /tests/modules/process/test.lua | |
| parent | 83f448dc569b70410765dfe6241fabc351feb54f (diff) | |
| parent | b6724648232ed892301457c05cf5ec4deaefc2ed (diff) | |
Merge pull request #110 from TitanSnow/wincov
add tests for C part
Diffstat (limited to 'tests/modules/process/test.lua')
| -rw-r--r-- | tests/modules/process/test.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/modules/process/test.lua b/tests/modules/process/test.lua new file mode 100644 index 000000000..69fe0b676 --- /dev/null +++ b/tests/modules/process/test.lua @@ -0,0 +1,51 @@ +function main() + -- single process test + local inftimeout=999 + local stdout=os.tmpfile() + local stderr=os.tmpfile() + for i = 1, 2 do + local pro=process.open("echo -n awd",stdout,stderr) + process.wait(pro,inftimeout) + process.close(pro) + assert(io.readfile(stdout)=="awd") + end + -- hack test + local hacked = false + try{ + function () + process.wait("awd",inftimeout) + hacked = true + end + } + assert(not hacked) + hacked = (process.close("awd") ~= nil) + assert(not hacked) + try{ + function () + process.waitlist("awd",inftimeout) + hacked = true + end + } + assert(not hacked) + try{ + function () + process.waitlist({},inftimeout) + hacked = true + end + } + assert(not hacked) + try{ + function () + process.waitlist({"awd"},inftimeout) + hacked = true + end + } + assert(not hacked) + try{ + function () + process.open("thismustnotbeaprogramname") + hacked = true + end + } + assert(not hacked) +end |
