MCPcopy Create free account
hub / github.com/ddev/ddev / TestReplaceStringInFile

Function TestReplaceStringInFile

pkg/fileutil/files_test.go:173–182  ·  view source on GitHub ↗

TestReplaceStringInFile tests the ReplaceStringInFile utility function.

(t *testing.T)

Source from the content-addressed store, hash-verified

171
172// TestReplaceStringInFile tests the ReplaceStringInFile utility function.
173func TestReplaceStringInFile(t *testing.T) {
174 assert := asrt.New(t)
175 tmpDir := testcommon.CreateTmpDir(t.Name())
176 newFilePath := filepath.Join(tmpDir, "newfile.txt")
177 err := fileutil.ReplaceStringInFile("some needle we're looking for", "specialJUNKPattern", "testdata/fgrep_has_positive_contents.txt", newFilePath)
178 assert.NoError(err)
179 found, err := fileutil.FgrepStringInFile(newFilePath, "specialJUNKPattern")
180 assert.NoError(err)
181 assert.True(found)
182}
183
184// TestFindSimulatedXsymSymlinks tests FindSimulatedXsymSymlinks
185func TestFindSimulatedXsymSymlinks(t *testing.T) {

Callers

nothing calls this directly

Calls 3

CreateTmpDirFunction · 0.92
ReplaceStringInFileFunction · 0.92
FgrepStringInFileFunction · 0.92

Tested by

no test coverage detected