diff options
Diffstat (limited to 'testes')
-rw-r--r-- | testes/files.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testes/files.lua b/testes/files.lua index 677c0dc2..16cf9b6a 100644 --- a/testes/files.lua +++ b/testes/files.lua | |||
@@ -721,6 +721,21 @@ if not _port then | |||
721 | progname = '"' .. arg[i + 1] .. '"' | 721 | progname = '"' .. arg[i + 1] .. '"' |
722 | end | 722 | end |
723 | print("testing popen/pclose and execute") | 723 | print("testing popen/pclose and execute") |
724 | -- invalid mode for popen | ||
725 | checkerr("invalid mode", io.popen, "cat", "") | ||
726 | checkerr("invalid mode", io.popen, "cat", "r+") | ||
727 | checkerr("invalid mode", io.popen, "cat", "rw") | ||
728 | do -- basic tests for popen | ||
729 | local file = os.tmpname() | ||
730 | local f = assert(io.popen("cat - > " .. file, "w")) | ||
731 | f:write("a line") | ||
732 | assert(f:close()) | ||
733 | local f = assert(io.popen("cat - < " .. file, "r")) | ||
734 | assert(f:read("a") == "a line") | ||
735 | assert(f:close()) | ||
736 | assert(os.remove(file)) | ||
737 | end | ||
738 | |||
724 | local tests = { | 739 | local tests = { |
725 | -- command, what, code | 740 | -- command, what, code |
726 | {"ls > /dev/null", "ok"}, | 741 | {"ls > /dev/null", "ok"}, |