MCPcopy Create free account
hub / github.com/craftvscruft/tfrefactor / assertFileHasContents

Function assertFileHasContents

refactor/mv_test.go:176–184  ·  view source on GitHub ↗
(t *testing.T, expectedFile string, actualContents string)

Source from the content-addressed store, hash-verified

174}
175
176func assertFileHasContents(t *testing.T, expectedFile string, actualContents string) {
177 expectedBuf, err := ioutil.ReadFile(expectedFile)
178 if err != nil {
179 log.Fatalf("Loading %v - %v", expectedFile, err)
180 }
181 expected := strings.TrimSpace(string(normalizeNewlines(expectedBuf)))
182 actual := strings.TrimSpace(string(normalizeNewlines([]byte(actualContents))))
183 assert.Equal(t, expected, actual, "File %v", expectedFile)
184}
185
186// NormalizeNewlines normalizes \r\n (windows) and \r (mac)
187// into \n (unix)

Callers 1

assertMockCmdFileOutputFunction · 0.85

Calls 1

normalizeNewlinesFunction · 0.85

Tested by

no test coverage detected