| 206 | } |
| 207 | |
| 208 | func TestCallingJsField(t *testing.T) { |
| 209 | a := &StructWithJsField1{Object: js.Global.Get("Array").New(100)} |
| 210 | b := &StructWithJsField2{object: js.Global.Get("Array").New(100)} |
| 211 | a.SetIndex(3, 123) |
| 212 | b.object.SetIndex(3, 123) |
| 213 | f := a.Slice |
| 214 | a2 := a.Slice(2, 44) |
| 215 | b2 := b.Slice(2, 44) |
| 216 | c2 := f(2, 44) |
| 217 | if len(a2) != 42 || len(b2) != 42 || len(c2) != 42 || a2[1] != 123 || b2[1] != 123 || c2[1] != 123 { |
| 218 | t.Fail() |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | func TestReflectionOnJsField(t *testing.T) { |
| 223 | a := StructWithJsField1{Object: js.Global.Get("Array").New(42)} |