Commit 2fdaf6da authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 50cf8b85
......@@ -156,6 +156,12 @@ func TestDeadlock(t *testing.T) {
}, "-tracetest.deadtime=0.5s")
}
// XXX race bug with sleep caught only by delay injection
// other tests
// TestExpectType demonstrates Expect asserting with "unexpected event type".
func TestExpectType(t *testing.T) {
verify(t, func(t *tracetest.T) {
......@@ -172,10 +178,25 @@ func TestExpectType(t *testing.T) {
})
}
// XXX race bug with sleep caught only by delay injection
// TestExpectValue demonstrates Expect asserting with "unexpected event value".
func TestExpectValue(t *testing.T) {
verify(t, func(t *tracetest.T) {
var wg sync.WaitGroup
defer wg.Wait()
wg.Add(1)
go func() { // thread 1
defer wg.Done()
hi("T1·A")
}()
t.Expect("t1", eventHello("T1·B"))
})
}
// --------
// ----------------------------------------
// verifyInSubprocess runs f in subprocess and verifies that its output matches testOutput.
func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string) {
......@@ -260,10 +281,14 @@ var testExpectMap = map[string]testExpect{
"TestExpectType": {1,
`--- FAIL: TestExpectType (<TIME>)
example_test.go:171: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:171: test shutdown: #streams: 1, #(pending events): 0
example_test.go:177: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:177: test shutdown: #streams: 1, #(pending events): 0
# t1
tracetest.go:<LINE>: t1: send: unexpected event type
`},
"TestExpectValue": {1,
`
`},
}
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