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

Function TestParseHunkHeader

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

Source from the content-addressed store, hash-verified

10)
11
12func TestParseHunkHeader(t *testing.T) {
13 tests := []struct {
14 header string
15 oldS, oldC int
16 newS, newC int
17 ok bool
18 }{
19 {"@@ -10,3 +14,2 @@", 10, 3, 14, 2, true},
20 {"@@ -1 +1 @@", 1, 1, 1, 1, true},
21 {"@@ -1,0 +5,3 @@ ctx", 1, 0, 5, 3, true},
22 {"@@ malformed", 0, 0, 0, 0, false},
23 }
24 for _, tc := range tests {
25 t.Run(tc.header, func(t *testing.T) {
26 oS, oC, nS, nC, ok := parseHunkHeader(tc.header)
27 assert.Equal(t, tc.ok, ok)
28 if tc.ok {
29 assert.Equal(t, tc.oldS, oS)
30 assert.Equal(t, tc.oldC, oC)
31 assert.Equal(t, tc.newS, nS)
32 assert.Equal(t, tc.newC, nC)
33 }
34 })
35 }
36}
37
38func TestParseUnifiedDiff_AdditionsAndDeletions(t *testing.T) {
39 raw := strings.Join([]string{

Callers

nothing calls this directly

Calls 1

parseHunkHeaderFunction · 0.85

Tested by

no test coverage detected