INNER CODE UNIT · Go

Compare

lamoda/gonkey · compare/compare.go:38

func Compare(expected, actual interface{}, params Params) []error {
	return compareBranch("$", expected, actual, &params)
}

func compareBranch(path string, expected, actual interface{}, params *Params) []error {
	expectedType := getType(expected)
	actualType := getType(actual)
	var errors []error

	// compare types
	if leafMatchType(expected) != regex && expectedType != actualType {
		errors = append(errors, makeError(path, "types do not match", expectedType, actualType))

		return errors
	}

	// compare scalars
	if isScalarType(actualType) && !params.IgnoreValues {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…