We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6327c16 commit afdb7e6Copy full SHA for afdb7e6
tests/misc_test.go
@@ -862,3 +862,29 @@ func TestVersion(t *testing.T) {
862
t.Fatalf("Got: runtime.Version() returned %q. Want: a valid Go version.", got)
863
}
864
865
+
866
+// https://github.com/gopherjs/gopherjs/issues/1163
867
+func TestReflectSetForEmbed(t *testing.T) {
868
+ type Point struct {
869
+ x int
870
+ y int
871
+ }
872
+ type Embed struct {
873
+ value bool
874
+ point Point
875
876
+ type A struct {
877
+ Embed
878
879
+ c := &A{}
880
+ c.value = true
881
+ c.point = Point{100, 200}
882
+ in := reflect.ValueOf(c).Elem()
883
+ v := reflect.New(in.Type())
884
+ e := v.Elem()
885
+ f0 := e.Field(0)
886
+ e.Set(in)
887
+ if e.Field(0) != f0 {
888
+ t.Fatalf("relfect.Set got %v, want %v", f0, e.Field(0))
889
890
+}
0 commit comments