aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Germain <bnt period germain arrobase gmail period com>2017-05-16 10:01:05 +0200
committerBenoit Germain <bnt period germain arrobase gmail period com>2017-05-16 10:01:05 +0200
commit568d085cc9dee5f569f8c750f419d913ac470ff7 (patch)
tree2b2437ef40f672ff15339dceb86966aca87ae613
parente75210b564d06ed7b3a377ad5463d9bc48ad9835 (diff)
downloadlanes-568d085cc9dee5f569f8c750f419d913ac470ff7.tar.gz
lanes-568d085cc9dee5f569f8c750f419d913ac470ff7.tar.bz2
lanes-568d085cc9dee5f569f8c750f419d913ac470ff7.zip
Add test for table caching in basic.lua
When transfering a table through multiple references, the transfer result should preserve reference equality.
-rw-r--r--tests/basic.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index 16919a3..c36088a 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -220,6 +220,10 @@ local chunk= function( linda )
220 220
221 k,v=receive(); WR( v.." received\n" ); assert( v==4 ) 221 k,v=receive(); WR( v.." received\n" ); assert( v==4 )
222 222
223 local subT1 = { "subT1"}
224 local subT2 = { "subT2"}
225 send { subT1, subT2, subT1, subT2}; WR( "{ subT1, subT2, subT1, subT2} sent\n" )
226
223 WR( "Lane ends!\n" ) 227 WR( "Lane ends!\n" )
224end 228end
225 229
@@ -263,6 +267,10 @@ assert( tables_match( a, {'a','b','c',d=10} ) )
263assert( PEEK() == nil ) 267assert( PEEK() == nil )
264SEND(4) 268SEND(4)
265 269
270local complex_table = RECEIVE(); WR( type(complex_table).." received\n" )
271assert( complex_table[1] == complex_table[3] and complex_table[2] == complex_table[4])
272WR( table.concat( {complex_table[1][1],complex_table[2][1],complex_table[3][1],complex_table[4][1]},", "))
273
266t = nil 274t = nil
267collectgarbage() 275collectgarbage()
268-- wait 276-- wait