diff options
| -rw-r--r-- | chat/chat_test.go | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/chat/chat_test.go b/chat/chat_test.go index bd4d1cb..fcdf4c9 100644 --- a/chat/chat_test.go +++ b/chat/chat_test.go @@ -45,13 +45,24 @@ func TestJoining(t *testing.T) {  func TestLeaving(t *testing.T) {  	InitRooms(10) -	b1, _, err := Join("test", "Foo") +	b1, r, err := Join("test", "Foo")  	if err != nil {  		t.Fatalf("Could not join room: %s", err)  	} +	b2, _, err := Join("test", "Bar") +  	b1.Leave() +	buddies := r.ListBuddies() +	for _, b := range buddies { +		if b == "Foo" { +			t.Error("Foo is still in buddy list, even after leaving") +		} +	} + +	b2.Leave() +  	// The room is now empty. It should no longer exist.  	if _, ok := rooms["test"]; ok {  		t.Error("Room test still exists, although no user is left") | 
