Upgrading server dependancies (#8154)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8d66523ba7
Коммит
961c04cae9
13
vendor/github.com/stretchr/objx/simple_example_test.go
сгенерированный
поставляемый
13
vendor/github.com/stretchr/objx/simple_example_test.go
сгенерированный
поставляемый
@@ -1,21 +1,23 @@
|
||||
package objx
|
||||
package objx_test
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/objx"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSimpleExample(t *testing.T) {
|
||||
|
||||
// build a map from a JSON object
|
||||
o := MustFromJSON(`{"name":"Mat","foods":["indian","chinese"], "location":{"county":"hobbiton","city":"the shire"}}`)
|
||||
o := objx.MustFromJSON(`{"name":"Mat","foods":["indian","chinese"], "location":{"county":"hobbiton","city":"the shire"}}`)
|
||||
|
||||
// Map can be used as a straight map[string]interface{}
|
||||
assert.Equal(t, o["name"], "Mat")
|
||||
|
||||
// Get an Value object
|
||||
v := o.Get("name")
|
||||
assert.Equal(t, v, &Value{data: "Mat"})
|
||||
require.NotNil(t, v)
|
||||
|
||||
// Test the contained value
|
||||
assert.False(t, v.IsInt())
|
||||
@@ -37,5 +39,4 @@ func TestSimpleExample(t *testing.T) {
|
||||
|
||||
// Get a value by using dot notation
|
||||
assert.Equal(t, "hobbiton", o.Get("location.county").Str())
|
||||
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user