You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/08/10 03:59:10 UTC
[09/17] lucy-clownfish git commit: Add tests for HashIterator.
Add tests for HashIterator.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/0f60ed4b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/0f60ed4b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/0f60ed4b
Branch: refs/heads/master
Commit: 0f60ed4b9902172e0f6b874fd24d6e303a4b4f00
Parents: a9ea543
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Wed Aug 5 17:16:49 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Aug 6 19:51:32 2015 -0700
----------------------------------------------------------------------
runtime/go/clownfish/hash_test.go | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f60ed4b/runtime/go/clownfish/hash_test.go
----------------------------------------------------------------------
diff --git a/runtime/go/clownfish/hash_test.go b/runtime/go/clownfish/hash_test.go
index 2716196..992024f 100644
--- a/runtime/go/clownfish/hash_test.go
+++ b/runtime/go/clownfish/hash_test.go
@@ -134,3 +134,21 @@ func TestHashEquals(t *testing.T) {
t.Error("Equals should return false for a different Go type.")
}
}
+
+func TestHashIterator(t *testing.T) {
+ hash := NewHash(0)
+ hash.Store("a", "foo")
+ iter := NewHashIterator(hash)
+ if !iter.Next() {
+ t.Error("Next() should proceed")
+ }
+ if key := iter.GetKey(); key != "a" {
+ t.Error("Expected \"a\", got %v", key)
+ }
+ if val, ok := iter.GetValue().(string); !ok || val != "foo" {
+ t.Error("Expected \"a\", got %v", val)
+ }
+ if iter.Next() {
+ t.Error("Next() should return false when iteration complete")
+ }
+}