Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antonholmquist committed Dec 4, 2014
1 parent 97933d2 commit 327999b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 4 additions & 4 deletions jason.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Value struct {
type Object struct {
Value
Map map[string]*Value // The formatted map with typed values
Valid bool
valid bool
}

// Create a new Value from a io.reader.
Expand Down Expand Up @@ -60,7 +60,7 @@ func (j *Value) get(key string) (*Value, error) {
obj := j.object()

// Only continue if it really is an object
if obj.Valid {
if obj.valid {
child, ok := obj.Map[key]
if ok {
return child, nil
Expand Down Expand Up @@ -269,7 +269,7 @@ func (j *Value) object() *Object {
}

obj := new(Object)
obj.Valid = valid
obj.valid = valid

m := make(map[string]*Value)

Expand All @@ -295,7 +295,7 @@ func (j *Value) AsObject() (*Object, error) {

var err error

if !obj.Valid {
if !obj.valid {
err = errors.New("Is not an object")
}

Expand Down
6 changes: 0 additions & 6 deletions jason_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ func TestFirst(t *testing.T) {
s, err := j.GetString("name")

assert.True(s == "anton" && err == nil, "name should be a string")
//assert.True(j.Get("name").IsObject() == false, "name should not be an object")

assert.True(j.object().Valid, "the object should be valid")

//assert.True(j.Has("name") == true, "has name")
//assert.True(j.Has("name2") == false, "do not have name2")

s, err = j.GetString("name")
assert.True(s == "anton" && err == nil, "name shoud match")
Expand Down

0 comments on commit 327999b

Please sign in to comment.