aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-12-17 15:45:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-12-17 15:45:13 -0300
commitc646e57fd6307bd891e4e50ef5d6ee56b34e4cac (patch)
treee8f2d8a7bcb9f5c51ddc03f94f576f2fc6f43f06 /testes
parente0ab13c62f2c1af0af955f173beb3ea6473e8064 (diff)
downloadlua-c646e57fd6307bd891e4e50ef5d6ee56b34e4cac.tar.gz
lua-c646e57fd6307bd891e4e50ef5d6ee56b34e4cac.tar.bz2
lua-c646e57fd6307bd891e4e50ef5d6ee56b34e4cac.zip
Joined common code in 'lua_rawset' and 'lua_rawsetp'
Diffstat (limited to 'testes')
-rw-r--r--testes/api.lua6
-rw-r--r--testes/strings.lua7
2 files changed, 9 insertions, 4 deletions
diff --git a/testes/api.lua b/testes/api.lua
index b2680633..b5657416 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -516,9 +516,11 @@ print"+"
516 516
517do -- getp/setp 517do -- getp/setp
518 local a = {} 518 local a = {}
519 T.testC("rawsetp 2 1", a, 20) 519 local a1 = T.testC("rawsetp 2 1; return 1", a, 20)
520 assert(a == a1)
520 assert(a[T.pushuserdata(1)] == 20) 521 assert(a[T.pushuserdata(1)] == 20)
521 assert(T.testC("rawgetp -1 1; return 1", a) == 20) 522 local a1, res = T.testC("rawgetp -1 1; return 2", a)
523 assert(a == a1 and res == 20)
522end 524end
523 525
524 526
diff --git a/testes/strings.lua b/testes/strings.lua
index f2f61413..2ce3ebc3 100644
--- a/testes/strings.lua
+++ b/testes/strings.lua
@@ -161,18 +161,21 @@ do -- tests for '%p' format
161 local null = string.format("%p", nil) 161 local null = string.format("%p", nil)
162 assert(string.format("%p", {}) ~= null) 162 assert(string.format("%p", {}) ~= null)
163 assert(string.format("%p", 4) == null) 163 assert(string.format("%p", 4) == null)
164 assert(string.format("%p", true) == null)
164 assert(string.format("%p", print) ~= null) 165 assert(string.format("%p", print) ~= null)
165 assert(string.format("%p", coroutine.running()) ~= null) 166 assert(string.format("%p", coroutine.running()) ~= null)
167 assert(string.format("%p", io.stdin) ~= null)
168 assert(string.format("%p", io.stdin) == string.format("%p", io.stdin))
166 do 169 do
167 local t1 = {}; local t2 = {} 170 local t1 = {}; local t2 = {}
168 assert(string.format("%p", t1) ~= string.format("%p", t2)) 171 assert(string.format("%p", t1) ~= string.format("%p", t2))
169 end 172 end
170 do -- short strings 173 do -- short strings are internalized
171 local s1 = string.rep("a", 10) 174 local s1 = string.rep("a", 10)
172 local s2 = string.rep("a", 10) 175 local s2 = string.rep("a", 10)
173 assert(string.format("%p", s1) == string.format("%p", s2)) 176 assert(string.format("%p", s1) == string.format("%p", s2))
174 end 177 end
175 do -- long strings 178 do -- long strings aren't internalized
176 local s1 = string.rep("a", 300); local s2 = string.rep("a", 300) 179 local s1 = string.rep("a", 300); local s2 = string.rep("a", 300)
177 assert(string.format("%p", s1) ~= string.format("%p", s2)) 180 assert(string.format("%p", s1) ~= string.format("%p", s2))
178 end 181 end