mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-02 02:30:43 +00:00
Bulk move from k8s.io/kubectl
This commit is contained in:
25
vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go
generated
vendored
Normal file
25
vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/modern-go/reflect2"
|
||||
"github.com/modern-go/test/must"
|
||||
"github.com/modern-go/test"
|
||||
"context"
|
||||
)
|
||||
|
||||
func Test_struct_ptr(t *testing.T) {
|
||||
type TestObject struct {
|
||||
Field1 *int
|
||||
}
|
||||
t.Run("PackEFace", test.Case(func(ctx context.Context) {
|
||||
valType := reflect2.TypeOf(TestObject{})
|
||||
ptr := valType.UnsafeNew()
|
||||
must.Equal(&TestObject{}, valType.PackEFace(ptr))
|
||||
}))
|
||||
t.Run("Indirect", test.Case(func(ctx context.Context) {
|
||||
valType := reflect2.TypeOf(TestObject{})
|
||||
must.Equal(TestObject{}, valType.Indirect(&TestObject{}))
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user