GetWorld returns (creating if necessary) a test singleton world. It calls Fatal on the provided test if there are problems.
(t *testing.T)
| 328 | // GetWorld returns (creating if necessary) a test singleton world. |
| 329 | // It calls Fatal on the provided test if there are problems. |
| 330 | func GetWorld(t *testing.T) *World { |
| 331 | w := theWorld |
| 332 | if w == nil { |
| 333 | var err error |
| 334 | w, err = NewWorld() |
| 335 | if err != nil { |
| 336 | t.Fatalf("Error finding test world: %v", err) |
| 337 | } |
| 338 | err = w.Start() |
| 339 | if err != nil { |
| 340 | t.Fatalf("Error starting test world: %v", err) |
| 341 | } |
| 342 | theWorld = w |
| 343 | } |
| 344 | return w |
| 345 | } |
| 346 | |
| 347 | // GetWorldMaybe returns the current World. It might be nil. |
| 348 | func GetWorldMaybe(t *testing.T) *World { |