Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-eventbus
Commits
454cbe54
Commit
454cbe54
authored
Jun 22, 2019
by
Jakub Sztandera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the test fail in reasonable time
License: MIT Signed-off-by:
Jakub Sztandera
<
kubuxu@protonmail.ch
>
parent
3fd76c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
basic_test.go
basic_test.go
+7
-0
No files found.
basic_test.go
View file @
454cbe54
...
...
@@ -318,6 +318,11 @@ func TestCloseBlocking(t *testing.T) {
sub
.
Close
()
// cancel sub
}
func
panicOnTimeout
(
d
time
.
Duration
)
{
<-
time
.
After
(
d
)
panic
(
"timeout reached"
)
}
func
TestSubFailFully
(
t
*
testing
.
T
)
{
bus
:=
NewBus
()
em
,
err
:=
bus
.
Emitter
(
new
(
EventB
))
...
...
@@ -330,6 +335,8 @@ func TestSubFailFully(t *testing.T) {
t
.
Fatal
(
err
)
}
go
panicOnTimeout
(
5
*
time
.
Second
)
em
.
Emit
(
EventB
(
159
))
// will hang if sub doesn't fail properly
}
...
...
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