Documentation ¶
Index ¶
- func AssertBoolAtPath(t *testing.T, data, path string, asserted bool) (ok bool)
- func AssertFloatArrayAtPath(t *testing.T, data, path string, asserted []interface{}) (ok bool)
- func AssertNumberAtPath(t *testing.T, data, path string, asserted float64) (ok bool)
- func AssertObjectAtPath(t *testing.T, data, path string) (ok bool)
- func AssertObjectAtPathWithKeys(t *testing.T, data, path string, keys []string) (ok bool)
- func AssertStringArrayAtPath(t *testing.T, data, path string, asserted []interface{}) (ok bool)
- func AssertStringAtPath(t *testing.T, data, path, asserted string) (ok bool)
- type JsonAssertion
- func (jas *JsonAssertion) IsBoolAt(path string, val bool) (ok bool)
- func (jas *JsonAssertion) IsIdenticalFloatSliceAt(path string, val []interface{}) (ok bool)
- func (jas *JsonAssertion) IsIdenticalStringSliceAt(path string, val []interface{}) (ok bool)
- func (jas *JsonAssertion) IsMatchingFloatSliceAt(path string, val []interface{}) (ok bool)
- func (jas *JsonAssertion) IsMatchingStringSliceAt(path string, val []interface{}) (ok bool)
- func (jas *JsonAssertion) IsNumberAt(path string, val float64) (ok bool)
- func (jas *JsonAssertion) IsObjectAt(path string) (ok bool)
- func (jas *JsonAssertion) IsStringAt(path string, val string) (ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertBoolAtPath ¶
func AssertFloatArrayAtPath ¶
func AssertNumberAtPath ¶
func AssertObjectAtPathWithKeys ¶
AssertObjectAtPathWithKeys attempts to locate an object (a JSON doc) at a given path. Given that there is an object there, it will assert that ALL the given property keys are found in the object, ignoring their value.
func AssertStringArrayAtPath ¶
Types ¶
type JsonAssertion ¶
type JsonAssertion struct {
// contains filtered or unexported fields
}
JsonAssertion is the struct we use to organize our walking of the JSON doc. The decoder is created by the Maker only. At the moment, the assertions are walking the JSON doc each time. Consider an extended method set that can reuse a single JsonAssertion, in cases of large numbers of asserts.
func MakeJsonAssertion ¶
func MakeJsonAssertion(data string) (jas *JsonAssertion, err error)
MakeJsonAssertion creates and initializes a JsonAssertion, with decoder instance, or returns an error.
func (*JsonAssertion) IsBoolAt ¶
func (jas *JsonAssertion) IsBoolAt(path string, val bool) (ok bool)
func (*JsonAssertion) IsIdenticalFloatSliceAt ¶
func (jas *JsonAssertion) IsIdenticalFloatSliceAt(path string, val []interface{}) (ok bool)
func (*JsonAssertion) IsIdenticalStringSliceAt ¶
func (jas *JsonAssertion) IsIdenticalStringSliceAt(path string, val []interface{}) (ok bool)
func (*JsonAssertion) IsMatchingFloatSliceAt ¶
func (jas *JsonAssertion) IsMatchingFloatSliceAt(path string, val []interface{}) (ok bool)
IsMatchingFloatSliceAt looks for a float slice at the given path, and if it finds one, compares them without regard to their ordering.
func (*JsonAssertion) IsMatchingStringSliceAt ¶
func (jas *JsonAssertion) IsMatchingStringSliceAt(path string, val []interface{}) (ok bool)
IsMatchingStringArrayAt Assert that a string array is found at the given path, which is 'similar' as in: same length, same elements but not in the same order.
func (*JsonAssertion) IsNumberAt ¶
func (jas *JsonAssertion) IsNumberAt(path string, val float64) (ok bool)
func (*JsonAssertion) IsObjectAt ¶
func (jas *JsonAssertion) IsObjectAt(path string) (ok bool)
func (*JsonAssertion) IsStringAt ¶
func (jas *JsonAssertion) IsStringAt(path string, val string) (ok bool)