From 358bdfb1f482a1349bbe435f1bf74b32f8857d52 Mon Sep 17 00:00:00 2001 From: Seoester Date: Wed, 1 Jun 2016 13:25:00 +0200 Subject: [PATCH] Iterator: Added IteratorStop test --- set_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/set_test.go b/set_test.go index 6829e34..f8f05f9 100644 --- a/set_test.go +++ b/set_test.go @@ -800,6 +800,21 @@ func Test_UnsafeIterator(t *testing.T) { } } +func Test_IteratorStop(t *testing.T) { + a := NewSet() + + a.Add("Z") + a.Add("Y") + a.Add("X") + a.Add("W") + + it := a.Iterator() + it.Stop() + for _ = range it.C { + t.Error("The iterating (Iterator) did not stop after Stop() has been called") + } +} + func Test_PowerSet(t *testing.T) { a := NewThreadUnsafeSet()