Commit 74905116 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5b07254a
......@@ -106,7 +106,7 @@ func TestTracetestExample(t *testing.T) {
}()
// assert that events come as expected
t.Expect("t2", eventHello("T1·C"))
t.Expect("t2", eventHello("T2·C"))
t.Expect("t1", eventHi("T1·A"))
t.Expect("t1", eventHello("T1·B"))
......
......@@ -523,12 +523,16 @@ func (t *T) SetEventRouter(routeEvent func(event interface{}) (stream string)) {
// XXX doc; naming
func (t *T) RxEvent(event interface{}) {
stream := "default"
t.streamTabMu.Lock()
ch := t.chanForEvent(event)
if t.routeEvent != nil {
stream = t.routeEvent(event)
}
ch := t.chanForStream(stream)
t.streamTabMu.Unlock()
if ch == nil {
t.fatalfInNonMain("test failed")
t.fatalfInNonMain("%s: send: canceled (test failed)", stream)
}
// TODO it is possible to empirically detect here if a test incorrectly
......@@ -563,6 +567,7 @@ func (t *T) RxEvent(event interface{}) {
ch.Send(event)
}
/*
// chanForEvent returns channel corresponding to stream where event has to be delivered.
// must be called under streamTabMu.
func (t *T) chanForEvent(event interface{}) Chan {
......@@ -572,6 +577,7 @@ func (t *T) chanForEvent(event interface{}) Chan {
}
return t.chanForStream(stream)
}
*/
// chanForStream returns channel corresponding to stream.
// must be called under streamTabMu.
......@@ -790,7 +796,7 @@ func (t *T) FailNow() {
__.msg.nak(__.why)
}
for _, __ := range sendv {
__.msg.nak("test failed") // XXX reason can be custom / different
__.msg.nak("canceled (test failed)") // XXX reason can be custom / different
}
// in any case close channel where future Sends may arrive so that will "panic" too.
for _, ch := range streamTab {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment