mirror of
https://github.com/elyby/chrly.git
synced 2025-05-31 14:11:51 +05:30
Replace event dispatcher by the fork to allow emitting events with nil arguments
This commit is contained in:
7
Gopkg.lock
generated
7
Gopkg.lock
generated
@@ -15,12 +15,13 @@
|
|||||||
version = "1.1"
|
version = "1.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "publish_nil_values"
|
||||||
digest = "1:33c6f6a0ee7d594d07ad9b67e93266f8a859ab2ddd882f8be19207162f40cce8"
|
digest = "1:d02c8323070a3d8d8ca039d0d180198ead0a75eac4fb1003af812435a2b391e8"
|
||||||
name = "github.com/asaskevich/EventBus"
|
name = "github.com/asaskevich/EventBus"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = ""
|
pruneopts = ""
|
||||||
revision = "d46933a94f05c6657d7b923fcf5ac563ee37ec79"
|
revision = "33b3bc6a7ddca2f99683c5c3ee86b24f80a7a075"
|
||||||
|
source = "https://github.com/erickskrauch/EventBus.git"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:c7b11da9bf0707e6920e1b361fbbbbe9b277ef3a198377baa4527f6e31049be0"
|
digest = "1:c7b11da9bf0707e6920e1b361fbbbbe9b277ef3a198377baa4527f6e31049be0"
|
||||||
|
@@ -37,8 +37,9 @@ ignored = ["github.com/elyby/chrly"]
|
|||||||
branch = "master"
|
branch = "master"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
branch = "master"
|
|
||||||
name = "github.com/asaskevich/EventBus"
|
name = "github.com/asaskevich/EventBus"
|
||||||
|
source = "https://github.com/erickskrauch/EventBus.git"
|
||||||
|
branch = "publish_nil_values"
|
||||||
|
|
||||||
# Testing dependencies
|
# Testing dependencies
|
||||||
|
|
||||||
|
@@ -17,20 +17,6 @@ type StatsReporterTestCase struct {
|
|||||||
ExpectedCalls [][]interface{}
|
ExpectedCalls [][]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type NilErr struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *NilErr) Error() string {
|
|
||||||
panic("don't call me")
|
|
||||||
}
|
|
||||||
|
|
||||||
// This let me to test events with nil error arguments.
|
|
||||||
// I can't just use `var nilErr error = nil`, because when Golang calls reflect.ValueOf()
|
|
||||||
// its returns only nil, without type. But when he calls reflection on specific structure (or pointer in this case),
|
|
||||||
// everything works fine. This is a memorial of 2 hours of my life, debugging and learning from the reflection
|
|
||||||
// about Go's types system. Nothing to regret.
|
|
||||||
var nilErr *NilErr = nil
|
|
||||||
|
|
||||||
var statsReporterTestCases = []*StatsReporterTestCase{
|
var statsReporterTestCases = []*StatsReporterTestCase{
|
||||||
// Before request
|
// Before request
|
||||||
{
|
{
|
||||||
@@ -189,7 +175,7 @@ var statsReporterTestCases = []*StatsReporterTestCase{
|
|||||||
{
|
{
|
||||||
Events: map[string][]interface{}{
|
Events: map[string][]interface{}{
|
||||||
"mojang_textures:before_result": {"username", ""},
|
"mojang_textures:before_result": {"username", ""},
|
||||||
"mojang_textures:after_result": {"username", &mojang.SignedTexturesResponse{}, nilErr},
|
"mojang_textures:after_result": {"username", &mojang.SignedTexturesResponse{}, nil},
|
||||||
},
|
},
|
||||||
ExpectedCalls: [][]interface{}{
|
ExpectedCalls: [][]interface{}{
|
||||||
{"RecordTimer", "mock_prefix.mojang_textures.result_time", mock.AnythingOfType("time.Duration")},
|
{"RecordTimer", "mock_prefix.mojang_textures.result_time", mock.AnythingOfType("time.Duration")},
|
||||||
@@ -198,7 +184,7 @@ var statsReporterTestCases = []*StatsReporterTestCase{
|
|||||||
{
|
{
|
||||||
Events: map[string][]interface{}{
|
Events: map[string][]interface{}{
|
||||||
"mojang_textures:textures:before_call": {"аааааааааааааааааааааааааааааааа"},
|
"mojang_textures:textures:before_call": {"аааааааааааааааааааааааааааааааа"},
|
||||||
"mojang_textures:textures:after_call": {"аааааааааааааааааааааааааааааааа", &mojang.SignedTexturesResponse{}, nilErr},
|
"mojang_textures:textures:after_call": {"аааааааааааааааааааааааааааааааа", &mojang.SignedTexturesResponse{}, nil},
|
||||||
},
|
},
|
||||||
ExpectedCalls: [][]interface{}{
|
ExpectedCalls: [][]interface{}{
|
||||||
{"IncCounter", "mock_prefix.mojang_textures.textures.request", int64(1)},
|
{"IncCounter", "mock_prefix.mojang_textures.textures.request", int64(1)},
|
||||||
|
Reference in New Issue
Block a user