aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-06-03 17:48:07 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-06-03 17:48:07 +0200
commit2baf7a6e001951d08098149d80d7ce79e7035a16 (patch)
treeb5dfa1ffddac0eaa29fdec5eda3c290b1e58c029 /tests
parent09635e063c007c4bda684ee21abb55c7470ee0e0 (diff)
downloadlanes-2baf7a6e001951d08098149d80d7ce79e7035a16.tar.gz
lanes-2baf7a6e001951d08098149d80d7ce79e7035a16.tar.bz2
lanes-2baf7a6e001951d08098149d80d7ce79e7035a16.zip
New global setting "strip_functions"
Diffstat (limited to 'tests')
-rw-r--r--tests/basic.lua24
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index da7d756..fff19ed 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -6,8 +6,8 @@
6-- To do: 6-- To do:
7-- - ... 7-- - ...
8-- 8--
9 9local config = { with_timers = false, strip_functions = false, internal_allocator = "libc"}
10local require_lanes_result_1, require_lanes_result_2 = require "lanes".configure{ with_timers = false, internal_allocator = "libc"} 10local require_lanes_result_1, require_lanes_result_2 = require "lanes".configure(config)
11print("require_lanes_result:", require_lanes_result_1, require_lanes_result_2) 11print("require_lanes_result:", require_lanes_result_1, require_lanes_result_2)
12local lanes = require_lanes_result_1 12local lanes = require_lanes_result_1
13 13
@@ -403,26 +403,28 @@ local function chunk2(linda)
403 -- 403 --
404 local info= debug.getinfo(1) -- 1 = us 404 local info= debug.getinfo(1) -- 1 = us
405 -- 405 --
406 PRINT "debug.getinfo->"
406 for k,v in pairs(info) do PRINT(k,v) end 407 for k,v in pairs(info) do PRINT(k,v) end
407 408
408 assert(info.nups == (_VERSION == "Lua 5.1" and 2 or 3)) -- one upvalue + PRINT + _ENV (Lua 5.2 only) 409 -- some assertions are adjusted depending on config.strip_functions, because it changes what we get out of debug.getinfo
409 assert(info.what == "Lua") 410 assert(info.nups == (_VERSION == "Lua 5.1" and 3 or 4), "bad nups") -- upvalue + config + PRINT + _ENV (Lua > 5.2 only)
411 assert(info.what == "Lua", "bad what")
410 --assert(info.name == "chunk2") -- name does not seem to come through 412 --assert(info.name == "chunk2") -- name does not seem to come through
411 assert(string.match(info.source, "^@.*basic.lua$")) 413 assert(config.strip_functions and info.source=="=?" or string.match(info.source, "^@.*basic.lua$"), "bad info.source")
412 assert(string.match(info.short_src, "^.*basic.lua$")) 414 assert(config.strip_functions and info.short_src=="?" or string.match(info.short_src, "^.*basic.lua$"), "bad info.short_src")
413 -- These vary so let's not be picky (they're there..) 415 -- These vary so let's not be picky (they're there..)
414 -- 416 --
415 assert(info.linedefined > 200) -- start of 'chunk2' 417 assert(info.linedefined == 400, "bad linedefined") -- start of 'chunk2'
416 assert(info.currentline > info.linedefined) -- line of 'debug.getinfo' 418 assert(config.strip_functions and info.currentline==-1 or info.currentline > info.linedefined, "bad currentline") -- line of 'debug.getinfo'
417 assert(info.lastlinedefined > info.currentline) -- end of 'chunk2' 419 assert(info.lastlinedefined > info.currentline, "bad lastlinedefined") -- end of 'chunk2'
418 local k,func= linda:receive("down") 420 local k,func= linda:receive("down")
419 assert(type(func)=="function") 421 assert(type(func)=="function", "not a function")
420 assert(k=="down") 422 assert(k=="down")
421 423
422 func(linda) 424 func(linda)
423 425
424 local k,str= linda:receive("down") 426 local k,str= linda:receive("down")
425 assert(str=="ok") 427 assert(str=="ok", "bad receive result")
426 428
427 linda:send("up", function() return ":)" end, "ok2") 429 linda:send("up", function() return ":)" end, "ok2")
428end 430end