MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / TestParseUnifiedDiff_NewFile

Function TestParseUnifiedDiff_NewFile

vcs/git/git_diff_lines_test.go:76–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestParseUnifiedDiff_NewFile(t *testing.T) {
77 raw := strings.Join([]string{
78 "diff --git a/src/new.rs b/src/new.rs",
79 "new file mode 100644",
80 "index 0000000..abcdef",
81 "--- /dev/null",
82 "+++ b/src/new.rs",
83 "@@ -0,0 +1,3 @@",
84 "+pub fn a() {}",
85 "+",
86 "+pub fn b() {}",
87 "",
88 }, "\n")
89
90 got := parseUnifiedDiff(raw)
91 fd, ok := got["src/new.rs"]
92 require.True(t, ok)
93 assert.True(t, fd.IsNew)
94 assert.Equal(t, []int{1, 2, 3}, fd.Additions)
95}
96
97func TestGetCommitFileDiffs(t *testing.T) {
98 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 1

parseUnifiedDiffFunction · 0.85

Tested by

no test coverage detected