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

Function TestExtractHunkContext

internal/ui/diff_test.go:197–219  ·  view source on GitHub ↗

--- extractHunkContext ---

(t *testing.T)

Source from the content-addressed store, hash-verified

195// --- extractHunkContext ---
196
197func TestExtractHunkContext(t *testing.T) {
198 t.Parallel()
199 tests := []struct {
200 name string
201 input string
202 want string
203 }{
204 {"with_func", "@@ -13,6 +13,7 @@ func main() {", "func main() {"},
205 {"no_context", "@@ -13,6 +13,7 @@", "-13,6 +13,7"},
206 {"empty_context", "@@ -1,3 +1,4 @@ ", "-1,3 +1,4"},
207 {"complex", "@@ -100,20 +105,25 @@ type Foo struct {", "type Foo struct {"},
208 {"bare", "@@@@", ""},
209 }
210 for _, tt := range tests {
211 t.Run(tt.name, func(t *testing.T) {
212 t.Parallel()
213 got := extractHunkContext(tt.input)
214 if got != tt.want {
215 t.Errorf("extractHunkContext(%q) = %q, want %q", tt.input, got, tt.want)
216 }
217 })
218 }
219}
220
221// --- parseHunkHeader ---
222

Callers

nothing calls this directly

Calls 1

extractHunkContextFunction · 0.85

Tested by

no test coverage detected