mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-11 00:40:00 +08:00
feat: added configuration center function (#3035)
Co-authored-by: aiden.ma <Aiden.ma@yijinin.com>
This commit is contained in:
28
core/configcenter/unmarshaler_test.go
Normal file
28
core/configcenter/unmarshaler_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package configurator
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRegisterUnmarshaler(t *testing.T) {
|
||||
RegisterUnmarshaler("test", func(data []byte, v interface{}) error {
|
||||
return nil
|
||||
})
|
||||
|
||||
_, ok := Unmarshaler("test")
|
||||
assert.True(t, ok)
|
||||
|
||||
_, ok = Unmarshaler("test2")
|
||||
assert.False(t, ok)
|
||||
|
||||
_, ok = Unmarshaler("json")
|
||||
assert.True(t, ok)
|
||||
|
||||
_, ok = Unmarshaler("toml")
|
||||
assert.True(t, ok)
|
||||
|
||||
_, ok = Unmarshaler("yaml")
|
||||
assert.True(t, ok)
|
||||
}
|
||||
Reference in New Issue
Block a user