(t *testing.T)
| 394 | } |
| 395 | |
| 396 | func TestFuzzyResolveCsharpNamespace(t *testing.T) { |
| 397 | userCS := filepath.Join("MyApp", "Models", "User.cs") |
| 398 | productCS := filepath.Join("MyApp", "Models", "Product.cs") |
| 399 | serviceCS := filepath.Join("MyApp", "Services", "UserService.cs") |
| 400 | |
| 401 | files := []FileInfo{ |
| 402 | {Path: userCS}, |
| 403 | {Path: productCS}, |
| 404 | {Path: serviceCS}, |
| 405 | } |
| 406 | idx := buildFileIndex(files, "") |
| 407 | |
| 408 | t.Run("namespace with multiple files resolves via directory", func(t *testing.T) { |
| 409 | got := fuzzyResolve("MyApp.Models", "MyApp/Services/UserService.cs", idx, "", nil, "") |
| 410 | sort.Strings(got) |
| 411 | want := []string{productCS, userCS} |
| 412 | if !reflect.DeepEqual(got, want) { |
| 413 | t.Errorf("fuzzyResolve(MyApp.Models) = %v, want %v", got, want) |
| 414 | } |
| 415 | }) |
| 416 | |
| 417 | t.Run("namespace with single file resolves via directory", func(t *testing.T) { |
| 418 | got := fuzzyResolve("MyApp.Services", "MyApp/Program.cs", idx, "", nil, "") |
| 419 | want := []string{serviceCS} |
| 420 | if !reflect.DeepEqual(got, want) { |
| 421 | t.Errorf("fuzzyResolve(MyApp.Services) = %v, want %v", got, want) |
| 422 | } |
| 423 | }) |
| 424 | |
| 425 | t.Run("external namespace does not resolve", func(t *testing.T) { |
| 426 | got := fuzzyResolve("System.Collections.Generic", "MyApp/Program.cs", idx, "", nil, "") |
| 427 | if got != nil { |
| 428 | t.Errorf("expected nil for external namespace, got %v", got) |
| 429 | } |
| 430 | }) |
| 431 | } |
nothing calls this directly
no test coverage detected