Add StructToStruct

This commit is contained in:
George Suntres
2026-03-29 13:12:53 -04:00
parent 434ecef67a
commit 65eec3c3b1
4 changed files with 31 additions and 1 deletions

View File

@@ -4,6 +4,28 @@ import (
"testing"
)
func TestStructToStruct(t *testing.T) {
type O struct {
Name string
Age int
Active bool
}
o := &O{
Name: "Nick",
Age: 15,
Active: true,
}
var oo O
StructToStruct(o, &oo)
if oo.Name != "Nick" || oo.Age != 15 || !oo.Active {
t.Fatalf("failed to copy %v", oo)
}
}
func TestStructToMapRecursive(t *testing.T) {
type O struct {
Name string