diff options
author | Benoit Germain <bnt period germain arrobase gmail period com> | 2017-05-16 10:01:05 +0200 |
---|---|---|
committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2017-05-16 10:01:05 +0200 |
commit | 568d085cc9dee5f569f8c750f419d913ac470ff7 (patch) | |
tree | 2b2437ef40f672ff15339dceb86966aca87ae613 | |
parent | e75210b564d06ed7b3a377ad5463d9bc48ad9835 (diff) | |
download | lanes-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.lua | 8 |
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" ) |
224 | end | 228 | end |
225 | 229 | ||
@@ -263,6 +267,10 @@ assert( tables_match( a, {'a','b','c',d=10} ) ) | |||
263 | assert( PEEK() == nil ) | 267 | assert( PEEK() == nil ) |
264 | SEND(4) | 268 | SEND(4) |
265 | 269 | ||
270 | local complex_table = RECEIVE(); WR( type(complex_table).." received\n" ) | ||
271 | assert( complex_table[1] == complex_table[3] and complex_table[2] == complex_table[4]) | ||
272 | WR( table.concat( {complex_table[1][1],complex_table[2][1],complex_table[3][1],complex_table[4][1]},", ")) | ||
273 | |||
266 | t = nil | 274 | t = nil |
267 | collectgarbage() | 275 | collectgarbage() |
268 | -- wait | 276 | -- wait |