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

Function TestParseHunkHeaderSingleLine

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

Source from the content-addressed store, hash-verified

46}
47
48func TestParseHunkHeaderSingleLine(t *testing.T) {
49 repo := &Repository{}
50 hunk := &Hunk{
51 Text: []string{"@@ -1 +2 @@ function test"},
52 Type: HunkTypeHunk,
53 }
54
55 err := repo.parseHunkHeader(hunk)
56 if err != nil {
57 t.Fatalf("Failed to parse hunk header: %v", err)
58 }
59
60 if hunk.OldLine != 1 {
61 t.Errorf("Expected OldLine=1, got %d", hunk.OldLine)
62 }
63 if hunk.OldCnt != 1 {
64 t.Errorf("Expected OldCnt=1, got %d", hunk.OldCnt)
65 }
66 if hunk.NewLine != 2 {
67 t.Errorf("Expected NewLine=2, got %d", hunk.NewLine)
68 }
69 if hunk.NewCnt != 1 {
70 t.Errorf("Expected NewCnt=1, got %d", hunk.NewCnt)
71 }
72}
73
74func TestHunkSplittable(t *testing.T) {
75 repo := &Repository{}

Callers

nothing calls this directly

Calls 1

parseHunkHeaderMethod · 0.95

Tested by

no test coverage detected