(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestDetectLanguage(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | path string |
| 15 | expected string |
| 16 | }{ |
| 17 | {name: "go extension", path: "main.go", expected: "go"}, |
| 18 | {name: "uppercase extension", path: "handler.PY", expected: "python"}, |
| 19 | {name: "unknown extension", path: "README.md", expected: ""}, |
| 20 | {name: "no extension", path: "Makefile", expected: ""}, |
| 21 | } |
| 22 | |
| 23 | for _, tt := range tests { |
| 24 | t.Run(tt.name, func(t *testing.T) { |
| 25 | got := DetectLanguage(tt.path) |
| 26 | if got != tt.expected { |
| 27 | t.Errorf("DetectLanguage(%q) = %q, want %q", tt.path, got, tt.expected) |
| 28 | } |
| 29 | }) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | func TestNormalizeImport(t *testing.T) { |
| 34 | tests := []struct { |
nothing calls this directly
no test coverage detected