...

Source file src/github.com/imdario/mergo/issue83_test.go

Documentation: github.com/imdario/mergo

     1  package mergo_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/imdario/mergo"
     7  )
     8  
     9  type issue83My struct {
    10  	Data []int
    11  }
    12  
    13  func TestIssue83(t *testing.T) {
    14  	dst := issue83My{Data: []int{1, 2, 3}}
    15  	new := issue83My{}
    16  	if err := mergo.Merge(&dst, new, mergo.WithOverwriteWithEmptyValue); err != nil {
    17  		t.Error(err)
    18  	}
    19  	if len(dst.Data) > 0 {
    20  		t.Errorf("expected empty slice, got %v", dst.Data)
    21  	}
    22  }
    23  

View as plain text