MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / Verify

Function Verify

cft/parse/parse.go:80–93  ·  view source on GitHub ↗

Verify confirms that there is no semantic difference between the source cft.Template and the string representation in output. This can be used to ensure that the parse package hasn't done anything unexpected to your template.

(source *cft.Template, output string)

Source from the content-addressed store, hash-verified

78// This can be used to ensure that the parse package hasn't done
79// anything unexpected to your template.
80func Verify(source *cft.Template, output string) error {
81 // Check it matches the original
82 validate, err := String(output)
83 if err != nil {
84 return err
85 }
86
87 d := diff.New(source, validate)
88 if d.Mode() != diff.Unchanged {
89 return fmt.Errorf("semantic difference after formatting:\n%s", d.Format(false))
90 }
91
92 return nil
93}

Callers 4

TestVerifyOutputFunction · 0.92
TestUnicodeJsonFunction · 0.92
TestFnGetAZsFunction · 0.92
formatStringFunction · 0.92

Calls 4

NewFunction · 0.92
StringFunction · 0.70
ModeMethod · 0.65
FormatMethod · 0.65

Tested by 3

TestVerifyOutputFunction · 0.74
TestUnicodeJsonFunction · 0.74
TestFnGetAZsFunction · 0.74