Closed lchjczw closed 2 years ago
func TestDiff(t *testing.T) { type args struct { from interface{} to interface{} } type Info struct { Qq string Wechat string } type data struct { Name string Age int Height int Info listInt []int } tests := []struct { name string args args wantErr bool }{ { name: "lch", args: args{ from: data{ Name: "lch", Age: 1, Height: 1, Info: Info{ Qq: "qq", Wechat: "wechat", }, listInt: []int{1, 2, 3, 4}, }, to: data{ Name: "lchjczw", Age: 1, Height: 2, Info: Info{ Qq: "myqq", Wechat: "wechat", }, listInt: []int{1, 2, 3}, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { d, err := diff.NewDiffer(diff.AllowTypeMismatch(true), diff.FlattenEmbeddedStructs()) if err != nil { panic(err) } _, err = d.Diff(tt.args.from, tt.args.to) if (err != nil) != tt.wantErr { t.Errorf("Diff error = %v, wantErr %v", err, tt.wantErr) return } }) } }
What did I do wrong? Or maybe it's a bug
Hey @lchjczw , thanks for raising the issue! This should now be fixed with v2.14.2