MCPcopy
hub / github.com/kptdev/kpt / filterDiffMetadata

Function filterDiffMetadata

internal/util/diff/diff_test.go:253–267  ·  view source on GitHub ↗

filterDiffMetadata removes information from the diff output that is test-run specific for ex. removing directory name being used.

(r io.Reader)

Source from the content-addressed store, hash-verified

251// filterDiffMetadata removes information from the diff output that is test-run
252// specific for ex. removing directory name being used.
253func filterDiffMetadata(r io.Reader) string {
254 scanner := bufio.NewScanner(r)
255 b := &bytes.Buffer{}
256
257 for scanner.Scan() {
258 text := scanner.Text()
259 // filter out the diff command that contains directory names
260 if strings.HasPrefix(text, "diff ") {
261 continue
262 }
263 b.WriteString(text)
264 b.WriteString("\n")
265 }
266 return b.String()
267}
268
269func TestStagingDirectoryNames(t *testing.T) {
270 var tests = []struct {

Callers 3

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected