aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2023-09-13 19:40:22 -0300
committerGitHub <noreply@github.com>2023-09-13 19:40:22 -0300
commitb182b416169dc5286df737b7bf64dd6be1bb8eef (patch)
tree86925b0bff89c10889d339b9a4f44167c101f242 /tests
parent8f8e4c6adb43e107f5902e784ef207dc3c8ca06b (diff)
downloadlua-compat-5.3-b182b416169dc5286df737b7bf64dd6be1bb8eef.tar.gz
lua-compat-5.3-b182b416169dc5286df737b7bf64dd6be1bb8eef.tar.bz2
lua-compat-5.3-b182b416169dc5286df737b7bf64dd6be1bb8eef.zip
Support getting io.popen results on file:close() on PUC-Rio Lua 5.1 (#53)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test.lua14
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))
653end 667end
654___'' 668___''
655 669