Skip to content

Commit 2bd4083

Browse files
committed
Set: Add unit test to confirm that Flatten return the same cached result as before
1 parent dc50d65 commit 2bd4083

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

set/dict_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ func TestFlattenCaches(t *testing.T) {
118118
}
119119
}
120120

121+
func TestFlattenCaches_CacheReturn(t *testing.T) {
122+
set := New()
123+
item := `test`
124+
set.Add(item)
125+
126+
flatten1 := set.Flatten()
127+
flatten2 := set.Flatten()
128+
129+
if !reflect.DeepEqual(flatten1, flatten2) {
130+
t.Errorf(`Flatten cache is not the same as original result. Got %+v, expected %+v`, 1, flatten2, flatten1)
131+
}
132+
}
133+
121134
func TestAddClearsCache(t *testing.T) {
122135
set := New()
123136
item := `test`

0 commit comments

Comments
 (0)