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
2fdaf6da
Commit
2fdaf6da
authored
Dec 24, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
50cf8b85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
go/internal/xtracing/tracetest/example_test.go
go/internal/xtracing/tracetest/example_test.go
+29
-4
No files found.
go/internal/xtracing/tracetest/example_test.go
View file @
2fdaf6da
...
@@ -156,6 +156,12 @@ func TestDeadlock(t *testing.T) {
...
@@ -156,6 +156,12 @@ func TestDeadlock(t *testing.T) {
},
"-tracetest.deadtime=0.5s"
)
},
"-tracetest.deadtime=0.5s"
)
}
}
// XXX race bug with sleep caught only by delay injection
// other tests
// TestExpectType demonstrates Expect asserting with "unexpected event type".
// TestExpectType demonstrates Expect asserting with "unexpected event type".
func
TestExpectType
(
t
*
testing
.
T
)
{
func
TestExpectType
(
t
*
testing
.
T
)
{
verify
(
t
,
func
(
t
*
tracetest
.
T
)
{
verify
(
t
,
func
(
t
*
tracetest
.
T
)
{
...
@@ -172,10 +178,25 @@ func TestExpectType(t *testing.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.
// verifyInSubprocess runs f in subprocess and verifies that its output matches testOutput.
func
verifyInSubprocess
(
t
*
testing
.
T
,
f
func
(
t
*
testing
.
T
),
targvExtra
...
string
)
{
func
verifyInSubprocess
(
t
*
testing
.
T
,
f
func
(
t
*
testing
.
T
),
targvExtra
...
string
)
{
...
@@ -260,10 +281,14 @@ var testExpectMap = map[string]testExpect{
...
@@ -260,10 +281,14 @@ var testExpectMap = map[string]testExpect{
"TestExpectType"
:
{
1
,
"TestExpectType"
:
{
1
,
`--- FAIL: TestExpectType (<TIME>)
`--- FAIL: TestExpectType (<TIME>)
example_test.go:17
1
: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:17
7
: t1: expect: tracetest_test.eventHello: got tracetest_test.eventHi T1·A
example_test.go:17
1
: test shutdown: #streams: 1, #(pending events): 0
example_test.go:17
7
: test shutdown: #streams: 1, #(pending events): 0
# t1
# t1
tracetest.go:<LINE>: t1: send: unexpected event type
tracetest.go:<LINE>: t1: send: unexpected event type
`
},
"TestExpectValue"
:
{
1
,
`
`
},
`
},
}
}
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