MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / MarshalMatches

Function MarshalMatches

internal/testing/cmp/cmp.go:85–93  ·  view source on GitHub ↗

MarshalMatches converts actual to YAML and compares that to expected.

(actual any, expected string)

Source from the content-addressed store, hash-verified

83
84// MarshalMatches converts actual to YAML and compares that to expected.
85func MarshalMatches(actual any, expected string) Comparison {
86 b, err := yaml.Marshal(actual)
87 if err != nil {
88 return func() gotest.Result { return gotest.ResultFromError(err) }
89 }
90 return gotest.DeepEqual(string(b), dedentLines(
91 strings.TrimLeft(strings.TrimRight(expected, "\t\n"), "\n"), 2,
92 ))
93}
94
95// Or is an alias to [stdcmp.Or] in the standard library:
96// - It returns the leftmost argument that is not zero.

Calls 1

dedentLinesFunction · 0.70