MCPcopy Create free account
hub / github.com/JanSmrcka/differ / TestParseHunkHeader

Function TestParseHunkHeader

internal/ui/diff_test.go:223–249  ·  view source on GitHub ↗

--- parseHunkHeader ---

(t *testing.T)

Source from the content-addressed store, hash-verified

221// --- parseHunkHeader ---
222
223func TestParseHunkHeader(t *testing.T) {
224 t.Parallel()
225 tests := []struct {
226 name string
227 input string
228 wantOld int
229 wantNew int
230 }{
231 {"basic", "@@ -10,5 +20,8 @@", 10, 20},
232 {"no_count", "@@ -1 +1 @@", 1, 1},
233 {"large", "@@ -100,50 +200,60 @@ func foo()", 100, 200},
234 {"missing", "no hunk", 0, 0},
235 }
236 for _, tt := range tests {
237 t.Run(tt.name, func(t *testing.T) {
238 t.Parallel()
239 old, new := 0, 0
240 parseHunkHeader(tt.input, &old, &new)
241 if old != tt.wantOld {
242 t.Errorf("oldNum=%d, want %d", old, tt.wantOld)
243 }
244 if new != tt.wantNew {
245 t.Errorf("newNum=%d, want %d", new, tt.wantNew)
246 }
247 })
248 }
249}
250
251// --- fmtLineNum ---
252

Callers

nothing calls this directly

Calls 1

parseHunkHeaderFunction · 0.85

Tested by

no test coverage detected