Commit 886fdce3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2855a6d5
......@@ -790,30 +790,34 @@ func Verify(t testing.TB, f func(t *T)) {
tT := &T{_testing_TB: t, streamTab: make(map[string]Chan)}
// XXX
// verify in the end that no events are left unchecked / unconsumed,
// e.g. sent to RxEvent, but not received. Nak them if they are and fail.
//
// NOTE this complements T.Fatal and friends, because a test might
// think it completes successfully, but leaves unconsumed events behind it.
defer func() {
nnak := tT.closeStreamTab()
if nnak != 0 {
t.Fatal()
}
func() {
// verify in the end that no events are left unchecked / unconsumed,
// e.g. sent to RxEvent, but not received. Nak them if they are and fail.
//
// NOTE this complements T.Fatal and friends, because a test might
// think it completes successfully, but leaves unconsumed events behind it.
defer func() {
nnak := tT.closeStreamTab()
if nnak != 0 {
t.Fatal()
}
}()
f(tT)
}()
f(tT)
// now, if f succeeds, verify f with injected delays.
if tT.Failed() {
return
}
/*
// now verify f with injected delays.
trace0 := tT.tracev
// sort trace0 by time just in case - events migth come from multiple
// CPUs simultaneously, and so for close events they might be added to
// tracev not in time order.
sort.Slice(trace0, func(i, j int) bool {
return trace0[i].t.Before(trace[j].t)
}
*/
return trace0[i].t.Before(trace0[j].t)
})
// XXX in the end: verify that streams are the same from run to run (if completed successfully).
......
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