MCPcopy Create free account
hub / github.com/astercloud/aster / TestPID_Tell

Function TestPID_Tell

pkg/actor/actor_test.go:298–318  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

296}
297
298func TestPID_Tell(t *testing.T) {
299 system := NewSystem("test")
300 defer system.Shutdown()
301
302 counter := &CounterActor{}
303 pid := system.Spawn(counter, "counter")
304
305 // 使用 PID.Tell 发送消息
306 pid.Tell(&CountMsg{Value: 100})
307 time.Sleep(50 * time.Millisecond)
308
309 replyCh := make(chan int, 1)
310 pid.Tell(&GetCountMsg{ReplyTo: replyCh})
311
312 select {
313 case count := <-replyCh:
314 assert.Equal(t, 100, count)
315 case <-time.After(time.Second):
316 t.Fatal("timeout")
317 }
318}
319
320func TestPID_Request(t *testing.T) {
321 system := NewSystem("test")

Callers

nothing calls this directly

Calls 4

ShutdownMethod · 0.95
SpawnMethod · 0.95
NewSystemFunction · 0.85
TellMethod · 0.80

Tested by

no test coverage detected