@@ -59,27 +59,31 @@ func TestWithIndex(t *testing.T) {
5959}
6060
6161func TestNewDigester (t * testing.T ) {
62- t .Run ("default" , func (t * testing.T ) {
63- g := NewWithT (t )
62+ g := NewWithT (t )
6463
64+ t .Run ("default" , func (t * testing.T ) {
6565 d := NewDigester ()
66-
6766 g .Expect (d ).ToNot (BeNil ())
68- g .Expect (d .index ).ToNot ( BeNil ())
67+ g .Expect (d .index ).To ( BeEmpty ())
6968 g .Expect (d .digests ).ToNot (BeNil ())
7069 })
7170
7271 t .Run ("with index" , func (t * testing.T ) {
73- g := NewWithT (t )
74-
75- i := map [string ]string {"foo" : "bar" }
76- d := NewDigester (WithIndex (i ))
77-
72+ initialIndex := map [string ]string {"foo" : "bar" }
73+ d := NewDigester (WithIndex (initialIndex ))
7874 g .Expect (d ).ToNot (BeNil ())
79- g .Expect (d .index ).To (Equal (i ))
75+ g .Expect (d .index ).To (Equal (initialIndex ))
8076 g .Expect (d .digests ).ToNot (BeNil ())
8177 })
8278
79+ t .Run ("handles multiple WithIndex options, applying last one" , func (t * testing.T ) {
80+ firstIndex := map [string ]string {"a" : "b" }
81+ secondIndex := map [string ]string {"c" : "d" }
82+ d := NewDigester (WithIndex (firstIndex ), WithIndex (secondIndex ))
83+ g .Expect (d .index ).To (Equal (secondIndex ))
84+ })
85+ }
86+
8387 t .Run ("handles multiple WithIndex options, applying last one" , func (t * testing.T ) {
8488 g := NewWithT (t )
8589 firstIndex := map [string ]string {"a" : "b" }
0 commit comments