diff options
Diffstat (limited to 'tests/basic.lua')
-rw-r--r-- | tests/basic.lua | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/basic.lua b/tests/basic.lua index b1e8fd3..352e029 100644 --- a/tests/basic.lua +++ b/tests/basic.lua | |||
@@ -171,7 +171,7 @@ local function PEEK() return linda:get("<-") end | |||
171 | local function SEND(...) linda:send( "->", ... ) end | 171 | local function SEND(...) linda:send( "->", ... ) end |
172 | local function RECEIVE() return linda:receive( "<-" ) end | 172 | local function RECEIVE() return linda:receive( "<-" ) end |
173 | 173 | ||
174 | local t= lanes_gen("io",chunk)(linda) -- prepare & launch | 174 | local t= lanes_gen("io,package",chunk)(linda) -- prepare & launch |
175 | 175 | ||
176 | SEND(1); WR( "1 sent\n" ) | 176 | SEND(1); WR( "1 sent\n" ) |
177 | SEND(2); WR( "2 sent\n" ) | 177 | SEND(2); WR( "2 sent\n" ) |
@@ -230,7 +230,7 @@ local tc= lanes_gen( "io", | |||
230 | end | 230 | end |
231 | STAGE("Hello") | 231 | STAGE("Hello") |
232 | STAGE("I was here first!") | 232 | STAGE("I was here first!") |
233 | STAGE("So waht?") | 233 | STAGE("So what?") |
234 | end | 234 | end |
235 | ) | 235 | ) |
236 | 236 | ||
@@ -247,7 +247,6 @@ local upvalue="123" | |||
247 | 247 | ||
248 | local function chunk2( linda ) | 248 | local function chunk2( linda ) |
249 | assert( upvalue=="123" ) -- even when running as separate thread | 249 | assert( upvalue=="123" ) -- even when running as separate thread |
250 | |||
251 | -- function name & line number should be there even as separate thread | 250 | -- function name & line number should be there even as separate thread |
252 | -- | 251 | -- |
253 | local info= debug.getinfo(1) -- 1 = us | 252 | local info= debug.getinfo(1) -- 1 = us |
@@ -256,17 +255,14 @@ local function chunk2( linda ) | |||
256 | 255 | ||
257 | assert( info.nups == 2 ) -- one upvalue + PRINT | 256 | assert( info.nups == 2 ) -- one upvalue + PRINT |
258 | assert( info.what == "Lua" ) | 257 | assert( info.what == "Lua" ) |
259 | |||
260 | --assert( info.name == "chunk2" ) -- name does not seem to come through | 258 | --assert( info.name == "chunk2" ) -- name does not seem to come through |
261 | assert( string.match( info.source, "^@basic.lua$" ) ) | 259 | assert( string.match( info.source, "^@.*basic.lua$" ) ) |
262 | assert( string.match( info.short_src, "^basic.lua$" ) ) | 260 | assert( string.match( info.short_src, "^.*basic.lua$" ) ) |
263 | |||
264 | -- These vary so let's not be picky (they're there..) | 261 | -- These vary so let's not be picky (they're there..) |
265 | -- | 262 | -- |
266 | assert( info.linedefined > 200 ) -- start of 'chunk2' | 263 | assert( info.linedefined > 200 ) -- start of 'chunk2' |
267 | assert( info.currentline > info.linedefined ) -- line of 'debug.getinfo' | 264 | assert( info.currentline > info.linedefined ) -- line of 'debug.getinfo' |
268 | assert( info.lastlinedefined > info.currentline ) -- end of 'chunk2' | 265 | assert( info.lastlinedefined > info.currentline ) -- end of 'chunk2' |
269 | |||
270 | local func,k= linda:receive( "down" ) | 266 | local func,k= linda:receive( "down" ) |
271 | assert( type(func)=="function" ) | 267 | assert( type(func)=="function" ) |
272 | assert( k=="down" ) | 268 | assert( k=="down" ) |
@@ -280,12 +276,9 @@ local function chunk2( linda ) | |||
280 | end | 276 | end |
281 | 277 | ||
282 | local linda= lanes.linda() | 278 | local linda= lanes.linda() |
283 | 279 | local t2= lanes_gen( "debug,string,io", chunk2 )(linda) -- prepare & launch | |
284 | local t2= lanes_gen( "debug,string", chunk2 )(linda) -- prepare & launch | ||
285 | |||
286 | linda:send( "down", function(linda) linda:send( "up", "ready!" ) end, | 280 | linda:send( "down", function(linda) linda:send( "up", "ready!" ) end, |
287 | "ok" ) | 281 | "ok" ) |
288 | |||
289 | -- wait to see if the tiny function gets executed | 282 | -- wait to see if the tiny function gets executed |
290 | -- | 283 | -- |
291 | local s= linda:receive( "up" ) | 284 | local s= linda:receive( "up" ) |