list_reference_counting.t (691B)
1 use strict; 2 use Test; 3 use SL::Test; 4 5 BEGIN { plan tests => 10 } 6 7 # Test list reference counting to make sure they stay alive when needed 8 my $s = SL::Test::Server->new(); 9 my $A = SL::Test::Client->new(); 10 my $B = SL::Test::Client->new(); 11 12 # A creates a new list 13 my $list = $A->list_add({ name => 'this list will belong to B soon enough', date => 0 }); 14 15 # XXX: missing steps 16 # - A and B become mutual friends 17 # - B requests his other lists 18 # - B joins A's list 19 20 # B joins A's list, A leaves its own list 21 $B->list_join($list->{num}); 22 $A->list_leave($list->{num}); 23 24 # B verifies its still in the list 25 ok( scalar(@{ $B->lists_get() }), 1 ); 26 27 # B also leaves the list 28 $B->list_leave($list->{num});