aboutsummaryrefslogtreecommitdiff
path: root/object/object_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'object/object_test.go')
-rw-r--r--object/object_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/object/object_test.go b/object/object_test.go
new file mode 100644
index 0000000..3d08c8b
--- /dev/null
+++ b/object/object_test.go
@@ -0,0 +1,22 @@
+package object
+
+import "testing"
+
+func TestStringhashKey(t *testing.T) {
+ hello1 := &String{Value: "Hello World"}
+ hello2 := &String{Value: "Hello World"}
+ diff1 := &String{Value: "My name is johnny"}
+ diff2 := &String{Value: "My name is johnny"}
+
+ if hello1.HashKey() != hello2.HashKey() {
+ t.Errorf("strings with same content have different hash keys")
+ }
+
+ if diff1.HashKey() != diff2.HashKey() {
+ t.Errorf("strings with same content have different hash keys")
+ }
+
+ if hello1.HashKey() == diff1.HashKey() {
+ t.Errorf("strings with different content have same hash keys")
+ }
+} \ No newline at end of file