-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
SakizciAdam
committed
Feb 27, 2022
1 parent
6fa32f7
commit 8a2428b
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package eventemitter_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/SakizciAdam/eventemitter" | ||
) | ||
|
||
func TestEventBus(t *testing.T) { | ||
bus := eventemitter.New() | ||
|
||
bus.AddListener("test", func(args ...interface{}) { | ||
if len(args) != 1 { | ||
t.Errorf("Expected 1 argument, got %d", len(args)) | ||
} | ||
|
||
if args[0] != "hello" { | ||
t.Errorf("Expected 'test', got '%s'", args[0]) | ||
} | ||
}) | ||
|
||
bus.EmitSync("test", "hello") | ||
} |