MCPcopy Create free account
hub / github.com/cwarden/git-add--interactive / TestParseHunkHeader

Function TestParseHunkHeader

internal/git/patch_test.go:22–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestParseHunkHeader(t *testing.T) {
23 repo := &Repository{}
24 hunk := &Hunk{
25 Text: []string{"@@ -1,5 +2,6 @@ function test"},
26 Type: HunkTypeHunk,
27 }
28
29 err := repo.parseHunkHeader(hunk)
30 if err != nil {
31 t.Fatalf("Failed to parse hunk header: %v", err)
32 }
33
34 if hunk.OldLine != 1 {
35 t.Errorf("Expected OldLine=1, got %d", hunk.OldLine)
36 }
37 if hunk.OldCnt != 5 {
38 t.Errorf("Expected OldCnt=5, got %d", hunk.OldCnt)
39 }
40 if hunk.NewLine != 2 {
41 t.Errorf("Expected NewLine=2, got %d", hunk.NewLine)
42 }
43 if hunk.NewCnt != 6 {
44 t.Errorf("Expected NewCnt=6, got %d", hunk.NewCnt)
45 }
46}
47
48func TestParseHunkHeaderSingleLine(t *testing.T) {
49 repo := &Repository{}

Callers

nothing calls this directly

Calls 1

parseHunkHeaderMethod · 0.95

Tested by

no test coverage detected