diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-01-29 14:17:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 14:17:40 -0800 |
commit | 961c04cae992eadb42d286d2f85f8a675bdc68c8 (patch) | |
tree | 3408f2d06f847e966c53485e2d54c692cdd037c1 /vendor/github.com/stretchr/objx/value_test.go | |
parent | 8d66523ba7d9a77129844be476732ebfd5272d64 (diff) | |
download | chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.gz chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.bz2 chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.zip |
Upgrading server dependancies (#8154)
Diffstat (limited to 'vendor/github.com/stretchr/objx/value_test.go')
-rw-r--r-- | vendor/github.com/stretchr/objx/value_test.go | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/vendor/github.com/stretchr/objx/value_test.go b/vendor/github.com/stretchr/objx/value_test.go index 0bc65d92c..1b1e3091f 100644 --- a/vendor/github.com/stretchr/objx/value_test.go +++ b/vendor/github.com/stretchr/objx/value_test.go @@ -1 +1,74 @@ -package objx +package objx_test + +import ( + "testing" + + "github.com/stretchr/objx" + "github.com/stretchr/testify/assert" +) + +func TestStringTypeString(t *testing.T) { + m := objx.Map{ + "string": "foo", + } + + assert.Equal(t, "foo", m.Get("string").String()) +} + +func TestStringTypeBool(t *testing.T) { + m := objx.Map{ + "bool": true, + } + + assert.Equal(t, "true", m.Get("bool").String()) +} + +func TestStringTypeInt(t *testing.T) { + m := objx.Map{ + "int": int(1), + "int8": int8(8), + "int16": int16(16), + "int32": int32(32), + "int64": int64(64), + } + + assert.Equal(t, "1", m.Get("int").String()) + assert.Equal(t, "8", m.Get("int8").String()) + assert.Equal(t, "16", m.Get("int16").String()) + assert.Equal(t, "32", m.Get("int32").String()) + assert.Equal(t, "64", m.Get("int64").String()) +} + +func TestStringTypeUint(t *testing.T) { + m := objx.Map{ + "uint": uint(1), + "uint8": uint8(8), + "uint16": uint16(16), + "uint32": uint32(32), + "uint64": uint64(64), + } + + assert.Equal(t, "1", m.Get("uint").String()) + assert.Equal(t, "8", m.Get("uint8").String()) + assert.Equal(t, "16", m.Get("uint16").String()) + assert.Equal(t, "32", m.Get("uint32").String()) + assert.Equal(t, "64", m.Get("uint64").String()) +} + +func TestStringTypeFloat(t *testing.T) { + m := objx.Map{ + "float32": float32(32.32), + "float64": float64(64.64), + } + + assert.Equal(t, "32.32", m.Get("float32").String()) + assert.Equal(t, "64.64", m.Get("float64").String()) +} + +func TestStringTypeOther(t *testing.T) { + m := objx.Map{ + "other": []string{"foo", "bar"}, + } + + assert.Equal(t, "[]string{\"foo\", \"bar\"}", m.Get("other").String()) +} |