aboutsummaryrefslogtreecommitdiffstats
path: root/event/event_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-10-17 00:59:28 +0800
committerFelix Lange <fjl@twurst.com>2014-10-17 00:59:28 +0800
commitfa84e50ddb8e64d4cb92d58e235cfed13761f21e (patch)
treed0dc6c7e0d31f49b0d3ac3cc2b7bb8550ea2351e /event/event_test.go
parentade980912da4afb7d92f845b8d41955851791dc9 (diff)
downloaddexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar.gz
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar.bz2
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar.lz
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar.xz
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.tar.zst
dexon-fa84e50ddb8e64d4cb92d58e235cfed13761f21e.zip
event: panic for duplicate type
Diffstat (limited to 'event/event_test.go')
-rw-r--r--event/event_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/event/event_test.go b/event/event_test.go
index f65aaa0a2..c7c0266c1 100644
--- a/event/event_test.go
+++ b/event/event_test.go
@@ -60,6 +60,21 @@ func TestUnsubscribeUnblockPost(t *testing.T) {
}
}
+func TestSubscribeDuplicateType(t *testing.T) {
+ mux := new(TypeMux)
+ expected := "event: duplicate type event.testEvent in Subscribe"
+
+ defer func() {
+ err := recover()
+ if err == nil {
+ t.Errorf("Subscribe didn't panic for duplicate type")
+ } else if err != expected {
+ t.Errorf("panic mismatch: got %#v, expected %#v", err, expected)
+ }
+ }()
+ mux.Subscribe(testEvent(1), testEvent(2))
+}
+
func TestMuxConcurrent(t *testing.T) {
rand.Seed(time.Now().Unix())
mux := new(TypeMux)