mirror of
https://github.com/genuinetools/reg.git
synced 2024-07-07 13:34:17 -04:00
37 lines
518 B
Go
37 lines
518 B
Go
package merge
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
)
|
|
|
|
func TestClone1(t *testing.T) {
|
|
f1 := &A{}
|
|
proto.Clone(f1)
|
|
}
|
|
|
|
func TestMerge1(t *testing.T) {
|
|
f1 := &A{}
|
|
f2 := &A{}
|
|
proto.Merge(f1, f2)
|
|
}
|
|
|
|
func TestMerge2(t *testing.T) {
|
|
f1 := &A{B: B{C: 1}}
|
|
f2 := &A{}
|
|
proto.Merge(f1, f2)
|
|
if f1.B.C != 1 {
|
|
t.Fatalf("got %d want %d", f1.B.C, 1)
|
|
}
|
|
}
|
|
|
|
func TestMerge3(t *testing.T) {
|
|
f1 := &A{}
|
|
f2 := &A{B: B{C: 1}}
|
|
proto.Merge(f1, f2)
|
|
if f1.B.C != 1 {
|
|
t.Fatalf("got %d want %d", f1.B.C, 1)
|
|
}
|
|
}
|