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
3fd76c7e
Commit
3fd76c7e
authored
Jun 22, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for #10
parent
525a0e67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
basic_test.go
basic_test.go
+15
-0
No files found.
basic_test.go
View file @
3fd76c7e
...
...
@@ -318,6 +318,21 @@ func TestCloseBlocking(t *testing.T) {
sub
.
Close
()
// cancel sub
}
func
TestSubFailFully
(
t
*
testing
.
T
)
{
bus
:=
NewBus
()
em
,
err
:=
bus
.
Emitter
(
new
(
EventB
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
_
,
err
=
bus
.
Subscribe
([]
interface
{}{
new
(
EventB
),
5
})
if
err
==
nil
||
err
.
Error
()
!=
"subscribe called with non-pointer type"
{
t
.
Fatal
(
err
)
}
em
.
Emit
(
EventB
(
159
))
// will hang if sub doesn't fail properly
}
func
testMany
(
t
testing
.
TB
,
subs
,
emits
,
msgs
int
,
stateful
bool
)
{
if
race
.
WithRace
()
&&
subs
+
emits
>
5000
{
t
.
SkipNow
()
...
...
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