aboutsummaryrefslogtreecommitdiff
path: root/testes/literals.lua
diff options
context:
space:
mode:
Diffstat (limited to 'testes/literals.lua')
-rw-r--r--testes/literals.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/testes/literals.lua b/testes/literals.lua
index e101eabf..d5a769ed 100644
--- a/testes/literals.lua
+++ b/testes/literals.lua
@@ -208,6 +208,30 @@ a = nil
208b = nil 208b = nil
209 209
210 210
211do -- reuse of long strings
212
213 -- get the address of a string
214 local function getadd (s) return string.format("%p", s) end
215
216 local s1 <const> = "01234567890123456789012345678901234567890123456789"
217 local s2 <const> = "01234567890123456789012345678901234567890123456789"
218 local s3 = "01234567890123456789012345678901234567890123456789"
219 local function foo() return s1 end
220 local function foo1() return s3 end
221 local function foo2()
222 return "01234567890123456789012345678901234567890123456789"
223 end
224 local a1 = getadd(s1)
225 assert(a1 == getadd(s2))
226 assert(a1 == getadd(foo()))
227 assert(a1 == getadd(foo1()))
228 assert(a1 == getadd(foo2()))
229
230 local sd = "0123456789" .. "0123456789012345678901234567890123456789"
231 assert(sd == s1 and getadd(sd) ~= a1)
232end
233
234
211-- testing line ends 235-- testing line ends
212prog = [[ 236prog = [[
213a = 1 -- a comment 237a = 1 -- a comment