diff options
Diffstat (limited to 'vendor/github.com/stretchr/objx/simple_example_test.go')
-rw-r--r-- | vendor/github.com/stretchr/objx/simple_example_test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/github.com/stretchr/objx/simple_example_test.go b/vendor/github.com/stretchr/objx/simple_example_test.go index 5408c7fd3..403753d65 100644 --- a/vendor/github.com/stretchr/objx/simple_example_test.go +++ b/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()) - } |