From fe179701f2cb32be250b3b882a02b02acad1cae5 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Tue, 25 Mar 2014 22:27:15 +0100 Subject: Expanded TestLeave --- chat/chat_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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") -- cgit v1.2.3-70-g09d2