Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
50cf8b85
Commit
50cf8b85
authored
Dec 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7394278b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
go/internal/xtracing/tracetest/example_test.go
go/internal/xtracing/tracetest/example_test.go
+26
-0
No files found.
go/internal/xtracing/tracetest/example_test.go
View file @
50cf8b85
...
@@ -156,6 +156,22 @@ func TestDeadlock(t *testing.T) {
...
@@ -156,6 +156,22 @@ func TestDeadlock(t *testing.T) {
},
"-tracetest.deadtime=0.5s"
)
},
"-tracetest.deadtime=0.5s"
)
}
}
// TestExpectType demonstrates Expect asserting with "unexpected event type".
func
TestExpectType
(
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·A"
))
})
}
// XXX race bug with sleep caught only by delay injection
// XXX race bug with sleep caught only by delay injection
...
@@ -231,6 +247,7 @@ type testExpect struct {
...
@@ -231,6 +247,7 @@ type testExpect struct {
// testExpectMap maps <test name> -> testExpect.
// testExpectMap maps <test name> -> testExpect.
var
testExpectMap
=
map
[
string
]
testExpect
{
var
testExpectMap
=
map
[
string
]
testExpect
{
"Test2ThreadsOK"
:
{
0
,
""
},
"Test2ThreadsOK"
:
{
0
,
""
},
"TestDeadlock"
:
{
1
,
"TestDeadlock"
:
{
1
,
`--- FAIL: TestDeadlock (<TIME>)
`--- FAIL: TestDeadlock (<TIME>)
example_test.go:155: t2: recv: deadlock waiting for *tracetest_test.eventHi
example_test.go:155: t2: recv: deadlock waiting for *tracetest_test.eventHi
...
@@ -240,4 +257,13 @@ var testExpectMap = map[string]testExpect{
...
@@ -240,4 +257,13 @@ var testExpectMap = map[string]testExpect{
tracetest.go:<LINE>: t1: send: canceled (test failed)
tracetest.go:<LINE>: t1: send: canceled (test failed)
`
},
`
},
"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
# t1
tracetest.go:<LINE>: t1: send: unexpected event type
`
},
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment