Этот коммит содержится в:
Christopher Speller
2018-01-29 14:17:40 -08:00
коммит произвёл GitHub
родитель 8d66523ba7
Коммит 961c04cae9
1508 изменённых файлов: 182081 добавлений и 24688 удалений

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())
}