diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test.lua b/tests/test.lua index 0640cae..443f6f7 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -625,11 +625,13 @@ do | |||
625 | end)) | 625 | end)) |
626 | if mode ~= "module" then | 626 | if mode ~= "module" then |
627 | local f = assert(io.open(self, "r")) | 627 | local f = assert(io.open(self, "r")) |
628 | print("io.type()", io.type(f)) | ||
628 | for a,b in f:lines(2, "*l") do | 629 | for a,b in f:lines(2, "*l") do |
629 | print("file:lines()", a, b) | 630 | print("file:lines()", a, b) |
630 | break | 631 | break |
631 | end | 632 | end |
632 | f:close() | 633 | f:close() |
634 | print("io.type()", io.type(f)) | ||
633 | f = assert(io.open("data.txt", "r")) | 635 | f = assert(io.open("data.txt", "r")) |
634 | for n1,n2,rest in f:lines("*n", "n", "*a") do | 636 | for n1,n2,rest in f:lines("*n", "n", "*a") do |
635 | print("file:lines()", n1, n2, rest) | 637 | print("file:lines()", n1, n2, rest) |
@@ -650,6 +652,18 @@ do | |||
650 | end)) | 652 | end)) |
651 | end | 653 | end |
652 | os.remove("data.txt") | 654 | os.remove("data.txt") |
655 | print("io.popen()", pcall(function() | ||
656 | local f = assert(io.popen("echo 'hello' && exit 0", "r")) | ||
657 | print("io.popen()", f:read("*a")) | ||
658 | print("io.popen()", f:close()) | ||
659 | end)) | ||
660 | print("io.popen()", pcall(function() | ||
661 | local f = assert(io.popen("echo 'hello' && exit 5", "r")) | ||
662 | print("io.type()", io.type(f)) | ||
663 | print("io.popen()", f:read("*a")) | ||
664 | print("io.popen()", f:close()) | ||
665 | print("io.type()", io.type(f)) | ||
666 | end)) | ||
653 | end | 667 | end |
654 | ___'' | 668 | ___'' |
655 | 669 | ||