Documentation ¶
Overview ¶
Package test contains testing utils functions.
Index ¶
- func Marshal(t *testing.T, testCases MarshallingCases)
- func MarshalUnmarshalled(t *testing.T, testCases MarshallingCases)
- func PrettyDiff(t *testing.T, expected, actual string)
- func PrettyMarshal(toMarshall interface{}) string
- func Unmarshal(t *testing.T, testCases MarshallingCases)
- func UnmarshalMarshalled(t *testing.T, testCases MarshallingCases)
- type MarshallingCases
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
func Marshal(t *testing.T, testCases MarshallingCases)
Marshal run testCases on json.Marshal function.
func MarshalUnmarshalled ¶
func MarshalUnmarshalled(t *testing.T, testCases MarshallingCases)
MarshalUnmarshalled first Unmarshal tc.JSON, then Marshal result from previous operation.
func PrettyDiff ¶
PrettyDiff print pretty diff of expected and actual using t.Errorf().
func PrettyMarshal ¶
func PrettyMarshal(toMarshall interface{}) string
PrettyMarshal return prettified json representation of the argument. Return empty string, if argument can not be represented as json.
func Unmarshal ¶
func Unmarshal(t *testing.T, testCases MarshallingCases)
Unmarshal run test cases on json.Unmarshal function.
func UnmarshalMarshalled ¶
func UnmarshalMarshalled(t *testing.T, testCases MarshallingCases)
UnmarshalMarshalled first Marshal tc.Model, then Unmarshal result from previous operation.
Types ¶
type MarshallingCases ¶
type MarshallingCases []struct { Model interface{} // JSON which is compared to json.Marshal result. // JSON can be in any valid format. Indents and white spaces are ignored. JSON string }
MarshallingCases contains test cases for Marshalling Test functions.
Click to show internal directories.
Click to hide internal directories.