aboutsummaryrefslogtreecommitdiff
path: root/testes/files.lua
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-17 10:42:56 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-17 10:42:56 -0300
commitf4211a5ea4e235ccfa8b8dfa46031c23e9e839e2 (patch)
tree3b8e1055f91a369de67e6b3b690a2c349c9541a1 /testes/files.lua
parent1b3f507f620d996ffb69da7476a19251acfb89ca (diff)
downloadlua-f4211a5ea4e235ccfa8b8dfa46031c23e9e839e2.tar.gz
lua-f4211a5ea4e235ccfa8b8dfa46031c23e9e839e2.tar.bz2
lua-f4211a5ea4e235ccfa8b8dfa46031c23e9e839e2.zip
More control over encoding of test files
The few UTF-8 test files are commented as such, and there is only one non UTF-8 test file (to test non UTF-8 sources).
Diffstat (limited to 'testes/files.lua')
-rw-r--r--testes/files.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/testes/files.lua b/testes/files.lua
index be00bf3f..1476006e 100644
--- a/testes/files.lua
+++ b/testes/files.lua
@@ -92,8 +92,8 @@ assert(io.output():seek("end") == string.len("alo joao"))
92 92
93assert(io.output():seek("set") == 0) 93assert(io.output():seek("set") == 0)
94 94
95assert(io.write('"álo"', "{a}\n", "second line\n", "third line \n")) 95assert(io.write('"alo"', "{a}\n", "second line\n", "third line \n"))
96assert(io.write('çfourth_line')) 96assert(io.write('Xfourth_line'))
97io.output(io.stdout) 97io.output(io.stdout)
98collectgarbage() -- file should be closed by GC 98collectgarbage() -- file should be closed by GC
99assert(io.input() == io.stdin and rawequal(io.output(), io.stdout)) 99assert(io.input() == io.stdin and rawequal(io.output(), io.stdout))
@@ -300,14 +300,14 @@ do -- test error returns
300end 300end
301checkerr("invalid format", io.read, "x") 301checkerr("invalid format", io.read, "x")
302assert(io.read(0) == "") -- not eof 302assert(io.read(0) == "") -- not eof
303assert(io.read(5, 'l') == '"álo"') 303assert(io.read(5, 'l') == '"alo"')
304assert(io.read(0) == "") 304assert(io.read(0) == "")
305assert(io.read() == "second line") 305assert(io.read() == "second line")
306local x = io.input():seek() 306local x = io.input():seek()
307assert(io.read() == "third line ") 307assert(io.read() == "third line ")
308assert(io.input():seek("set", x)) 308assert(io.input():seek("set", x))
309assert(io.read('L') == "third line \n") 309assert(io.read('L') == "third line \n")
310assert(io.read(1) == "ç") 310assert(io.read(1) == "X")
311assert(io.read(string.len"fourth_line") == "fourth_line") 311assert(io.read(string.len"fourth_line") == "fourth_line")
312assert(io.input():seek("cur", -string.len"fourth_line")) 312assert(io.input():seek("cur", -string.len"fourth_line"))
313assert(io.read() == "fourth_line") 313assert(io.read() == "fourth_line")