https://github.com/gopherjs/gopherjs/issues/1163
(t *testing.T)
| 899 | |
| 900 | // https://github.com/gopherjs/gopherjs/issues/1163 |
| 901 | func TestReflectSetForEmbed(t *testing.T) { |
| 902 | type Point struct { |
| 903 | x int |
| 904 | y int |
| 905 | } |
| 906 | type Embed struct { |
| 907 | value bool |
| 908 | point Point |
| 909 | } |
| 910 | type A struct { |
| 911 | Embed |
| 912 | } |
| 913 | c := &A{} |
| 914 | c.value = true |
| 915 | c.point = Point{100, 200} |
| 916 | in := reflect.ValueOf(c).Elem() |
| 917 | v := reflect.New(in.Type()) |
| 918 | e := v.Elem() |
| 919 | f0 := e.Field(0) |
| 920 | e.Set(in) |
| 921 | if e.Field(0) != f0 { |
| 922 | t.Fatalf("reflect.Set got %v, want %v", f0, e.Field(0)) |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | func TestAssignImplicitConversion(t *testing.T) { |
| 927 | type S struct{} |