Codebase list golang-github-imdario-mergo / c0bd9d15-5c14-408d-92dc-10704832b2fd/upstream/0.3.13+git20230113.1.12567bf issue83_test.go
c0bd9d15-5c14-408d-92dc-10704832b2fd/upstream/0.3.13+git20230113.1.12567bf

Tree @c0bd9d15-5c14-408d-92dc-10704832b2fd/upstream/0.3.13+git20230113.1.12567bf (Download .tar.gz)

issue83_test.go @c0bd9d15-5c14-408d-92dc-10704832b2fd/upstream/0.3.13+git20230113.1.12567bfraw · history · blame

package mergo_test

import (
	"testing"

	"github.com/imdario/mergo"
)

type issue83My struct {
	Data []int
}

func TestIssue83(t *testing.T) {
	dst := issue83My{Data: []int{1, 2, 3}}
	new := issue83My{}
	if err := mergo.Merge(&dst, new, mergo.WithOverwriteWithEmptyValue); err != nil {
		t.Error(err)
	}
	if len(dst.Data) > 0 {
		t.Errorf("expected empty slice, got %v", dst.Data)
	}
}