| 277 | } |
| 278 | |
| 279 | func TestGoroutineJsObject(t *testing.T) { |
| 280 | // Test that js.Object methods can be a goroutine body. |
| 281 | // https://github.com/gopherjs/gopherjs/issues/547. |
| 282 | if !(runtime.GOOS == "js" || runtime.GOARCH == "js") { |
| 283 | t.Skip("Test requires GopherJS") |
| 284 | } |
| 285 | o := js.Global.Get("Object").New() |
| 286 | go o.Set("x", "y") |
| 287 | // Wait until the goroutine executes successfully. Can't use locks here |
| 288 | // because goroutine body must be a bare js.Object method call. |
| 289 | for o.Get("x").String() != "y" { |
| 290 | runtime.Gosched() |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | func issue1106() { |
| 295 | select { |