Skip to content

Commit

Permalink
add test for deepMerge panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaq? Wiedmann committed May 18, 2022
1 parent 4bed36e commit 8109749
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pr211_2_test.go
@@ -0,0 +1,25 @@
package mergo

import (
"reflect"
"testing"
"time"
)

type transformer struct {
}

func (s *transformer) Transformer(t reflect.Type) func(dst, src reflect.Value) error {
return nil
}

func Test_deepMergeTransformerInvalidDestination(t *testing.T) {
foo := time.Time{}
src := reflect.ValueOf(foo)
deepMerge(reflect.Value{}, src, make(map[uintptr]*visit), 0, &Config{
Transformers: &transformer{},
})
// this test is intentionally not asserting on anything, it's sole
// purpose to verify deepMerge doesn't panic when a transformer is
// passed and the destination is invalid.
}

0 comments on commit 8109749

Please sign in to comment.