7
7
"time"
8
8
)
9
9
10
- var testFormat = FormatV2
11
-
12
10
func TestHash_identity (t * testing.T ) {
13
11
cases := []interface {}{
14
12
nil ,
@@ -42,7 +40,7 @@ func TestHash_identity(t *testing.T) {
42
40
// in the runtime in terms of ordering.
43
41
valuelist := make ([]uint64 , 100 )
44
42
for i := range valuelist {
45
- v , err := Hash (tc , testFormat , nil )
43
+ v , err := Hash (tc , nil )
46
44
if err != nil {
47
45
t .Fatalf ("Error: %s\n \n %#v" , err , tc )
48
46
}
@@ -171,13 +169,13 @@ func TestHash_equal(t *testing.T) {
171
169
for i , tc := range cases {
172
170
t .Run (fmt .Sprintf ("%d" , i ), func (t * testing.T ) {
173
171
t .Logf ("Hashing: %#v" , tc .One )
174
- one , err := Hash (tc .One , testFormat , nil )
172
+ one , err := Hash (tc .One , nil )
175
173
t .Logf ("Result: %d" , one )
176
174
if err != nil {
177
175
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
178
176
}
179
177
t .Logf ("Hashing: %#v" , tc .Two )
180
- two , err := Hash (tc .Two , testFormat , nil )
178
+ two , err := Hash (tc .Two , nil )
181
179
t .Logf ("Result: %d" , two )
182
180
if err != nil {
183
181
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
@@ -271,11 +269,11 @@ func TestHash_equalIgnore(t *testing.T) {
271
269
}
272
270
273
271
for _ , tc := range cases {
274
- one , err := Hash (tc .One , testFormat , nil )
272
+ one , err := Hash (tc .One , nil )
275
273
if err != nil {
276
274
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
277
275
}
278
- two , err := Hash (tc .Two , testFormat , nil )
276
+ two , err := Hash (tc .Two , nil )
279
277
if err != nil {
280
278
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
281
279
}
@@ -327,7 +325,7 @@ func TestHash_stringTagError(t *testing.T) {
327
325
}
328
326
329
327
for _ , tc := range cases {
330
- _ , err := Hash (tc .Test , testFormat , nil )
328
+ _ , err := Hash (tc .Test , nil )
331
329
if err != nil {
332
330
if ens , ok := err .(* ErrNotStringer ); ok {
333
331
if ens .Field != tc .Field {
@@ -400,11 +398,11 @@ func TestHash_equalNil(t *testing.T) {
400
398
}
401
399
402
400
for _ , tc := range cases {
403
- one , err := Hash (tc .One , testFormat , & HashOptions {ZeroNil : tc .ZeroNil })
401
+ one , err := Hash (tc .One , & HashOptions {ZeroNil : tc .ZeroNil })
404
402
if err != nil {
405
403
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
406
404
}
407
- two , err := Hash (tc .Two , testFormat , & HashOptions {ZeroNil : tc .ZeroNil })
405
+ two , err := Hash (tc .Two , & HashOptions {ZeroNil : tc .ZeroNil })
408
406
if err != nil {
409
407
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
410
408
}
@@ -445,11 +443,11 @@ func TestHash_equalSet(t *testing.T) {
445
443
}
446
444
447
445
for _ , tc := range cases {
448
- one , err := Hash (tc .One , testFormat , nil )
446
+ one , err := Hash (tc .One , nil )
449
447
if err != nil {
450
448
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
451
449
}
452
- two , err := Hash (tc .Two , testFormat , nil )
450
+ two , err := Hash (tc .Two , nil )
453
451
if err != nil {
454
452
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
455
453
}
@@ -491,11 +489,11 @@ func TestHash_includable(t *testing.T) {
491
489
}
492
490
493
491
for _ , tc := range cases {
494
- one , err := Hash (tc .One , testFormat , nil )
492
+ one , err := Hash (tc .One , nil )
495
493
if err != nil {
496
494
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
497
495
}
498
- two , err := Hash (tc .Two , testFormat , nil )
496
+ two , err := Hash (tc .Two , nil )
499
497
if err != nil {
500
498
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
501
499
}
@@ -542,11 +540,11 @@ func TestHash_ignoreZeroValue(t *testing.T) {
542
540
}
543
541
544
542
for _ , tc := range cases {
545
- hashA , err := Hash (structA , testFormat , & HashOptions {IgnoreZeroValue : tc .IgnoreZeroValue })
543
+ hashA , err := Hash (structA , & HashOptions {IgnoreZeroValue : tc .IgnoreZeroValue })
546
544
if err != nil {
547
545
t .Fatalf ("Failed to hash %#v: %s" , structA , err )
548
546
}
549
- hashB , err := Hash (structB , testFormat , & HashOptions {IgnoreZeroValue : tc .IgnoreZeroValue })
547
+ hashB , err := Hash (structB , & HashOptions {IgnoreZeroValue : tc .IgnoreZeroValue })
550
548
if err != nil {
551
549
t .Fatalf ("Failed to hash %#v: %s" , structB , err )
552
550
}
@@ -581,11 +579,11 @@ func TestHash_includableMap(t *testing.T) {
581
579
}
582
580
583
581
for _ , tc := range cases {
584
- one , err := Hash (tc .One , testFormat , nil )
582
+ one , err := Hash (tc .One , nil )
585
583
if err != nil {
586
584
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
587
585
}
588
- two , err := Hash (tc .Two , testFormat , nil )
586
+ two , err := Hash (tc .Two , nil )
589
587
if err != nil {
590
588
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
591
589
}
@@ -643,7 +641,7 @@ func TestHash_hashable(t *testing.T) {
643
641
644
642
for i , tc := range cases {
645
643
t .Run (fmt .Sprintf ("%d" , i ), func (t * testing.T ) {
646
- one , err := Hash (tc .One , testFormat , nil )
644
+ one , err := Hash (tc .One , nil )
647
645
if tc .Err != "" {
648
646
if err == nil {
649
647
t .Fatal ("expected error" )
@@ -659,7 +657,7 @@ func TestHash_hashable(t *testing.T) {
659
657
t .Fatalf ("Failed to hash %#v: %s" , tc .One , err )
660
658
}
661
659
662
- two , err := Hash (tc .Two , testFormat , nil )
660
+ two , err := Hash (tc .Two , nil )
663
661
if err != nil {
664
662
t .Fatalf ("Failed to hash %#v: %s" , tc .Two , err )
665
663
}
0 commit comments