Commit bec06159 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2bfd4d5f
...@@ -106,7 +106,7 @@ func TestTracetestExample(t *testing.T) { ...@@ -106,7 +106,7 @@ func TestTracetestExample(t *testing.T) {
}() }()
// assert that events come as expected // assert that events come as expected
t.Expect("t3", eventHi("T2·C")) t.Expect("t2", eventHello("T2·D"))
t.Expect("t1", eventHi("T1·A")) t.Expect("t1", eventHi("T1·A"))
t.Expect("t1", eventHello("T1·B")) t.Expect("t1", eventHello("T1·B"))
......
...@@ -92,8 +92,6 @@ import ( ...@@ -92,8 +92,6 @@ import (
"time" "time"
"github.com/kylelemons/godebug/pretty" "github.com/kylelemons/godebug/pretty"
// "lab.nexedi.com/kirr/go123/xruntime"
) )
var ( var (
...@@ -622,7 +620,7 @@ func (t *T) expect1(stream string, eventExpect interface{}) *Msg { ...@@ -622,7 +620,7 @@ func (t *T) expect1(stream string, eventExpect interface{}) *Msg {
if !reflect.DeepEqual(revent.Interface(), reventExpect.Interface()) { if !reflect.DeepEqual(revent.Interface(), reventExpect.Interface()) {
t.queuenak(msg, "unexpected event data") t.queuenak(msg, "unexpected event data")
t.Fatalf("%s: expect: %s:\nwant: %v\nhave: %v\ndiff:\n%s\n", t.Fatalf("%s: expect: %s:\nwant: %v\nhave: %v\ndiff:\n%s\n\n",
stream, stream,
reventExpect.Type(), reventExpect, revent, reventExpect.Type(), reventExpect, revent,
pretty.Compare(reventExpect.Interface(), revent.Interface())) pretty.Compare(reventExpect.Interface(), revent.Interface()))
...@@ -759,6 +757,7 @@ func (t *T) FailNow() { ...@@ -759,6 +757,7 @@ func (t *T) FailNow() {
t.streamTab = nil t.streamTab = nil
t.streamTabMu.Unlock() t.streamTabMu.Unlock()
// print details about pending events and all streams
type sendInfo struct{ch Chan; msg *Msg} type sendInfo struct{ch Chan; msg *Msg}
var sendv []sendInfo // sends are pending here var sendv []sendInfo // sends are pending here
var quietv []Chan // this channels are quiet var quietv []Chan // this channels are quiet
...@@ -783,23 +782,18 @@ func (t *T) FailNow() { ...@@ -783,23 +782,18 @@ func (t *T) FailNow() {
} }
} }
bad := "" pending := fmt.Sprintf("#streams: %d, #(pending events): %d\n", len(streams), len(sendv))
if len(sendv) == 0 {
bad += fmt.Sprintf("no pending events\n")
} else {
bad += fmt.Sprintf("%d pending event(s):\n", len(sendv))
for _, __ := range sendv { for _, __ := range sendv {
bad += fmt.Sprintf("%s\t<- %T %v\n", __.ch.name(), __.msg.Event, __.msg.Event) pending += fmt.Sprintf("%s\t<- %T %v\n", __.ch.name(), __.msg.Event, __.msg.Event)
}
} }
for _, ch := range quietv { for _, ch := range quietv {
bad += fmt.Sprintf("# %s\n", ch.name()) pending += fmt.Sprintf("# %s\n", ch.name())
} }
// log the details and nak senders that we received from. // log the details and nak senders that we received from.
// nak them only after details printout, so that our text comes first, // nak them only after details printout, so that our text comes first,
// and their "panics" don't get intermixed with it. // and their "panics" don't get intermixed with it.
t.Log(bad) t.Log(pending)
for _, __ := range t.nakq { for _, __ := range t.nakq {
__.msg.nak(__.why) __.msg.nak(__.why)
} }
......
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