diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-03-27 15:49:03 +0000 |
---|---|---|
committer | Maciej Piechotka <uzytkownik2@gmail.com> | 2013-03-31 17:38:03 +0200 |
commit | dd1449c61fb5ea1e25ada35ec13504c199440513 (patch) | |
tree | 0e5ddc234d0e206a06d27c4a2b5847cdc64f7ad1 /tests | |
parent | b7aeceb87be950a0df1004bc856c49f993be1262 (diff) | |
download | libgee-dd1449c61fb5ea1e25ada35ec13504c199440513.tar.gz |
Return true from HashSet.Iterator.foreach() if we fall off the end
This is documented to happen, and was implemented correctly in the other
collections, but not in HashSet.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testcollection.vala | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/testcollection.vala b/tests/testcollection.vala index ddb9308..090724a 100644 --- a/tests/testcollection.vala +++ b/tests/testcollection.vala @@ -667,17 +667,25 @@ public abstract class CollectionTests : Gee.TestCase { assert (test_collection.add ("three")); int count = 0; + bool res; - test_collection.foreach ((x) => {count++; return true;}); + res = test_collection.foreach ((x) => {count++; return true;}); assert (count == 3); + assert (res == true); - test_collection.iterator ().foreach ((x) => {count++; return true;}); + res = test_collection.iterator ().foreach ((x) => {count++; return true;}); assert (count == 6); + assert (res == true); Iterator<string> iter = test_collection.iterator (); assert (iter.next ()); - iter.foreach ((x) => {count++; return true;}); + res = iter.foreach ((x) => {count++; return true;}); assert (count == 9); + assert (res == true); + + res = test_collection.foreach ((x) => {count++; return false;}); + assert (count == 10); + assert (res == false); } public void test_map () { |