MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestNormalizeImport

Function TestNormalizeImport

scanner/filegraph_test.go:33–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestNormalizeImport(t *testing.T) {
34 tests := []struct {
35 name string
36 input string
37 expected string
38 }{
39 {name: "removes quotes", input: "\"pkg/util\"", expected: "pkg/util"},
40 {name: "python dots to slashes", input: "app.core.config", expected: filepath.Join("app", "core", "config")},
41 {name: "relative dotted import unchanged", input: "../app.core", expected: "../app.core"},
42 {name: "crate import converted", input: "crate::feature::parser", expected: filepath.Join("feature", "parser")},
43 {name: "super import converted", input: "super::module::item", expected: filepath.Join("super", "module", "item")},
44 }
45
46 for _, tt := range tests {
47 t.Run(tt.name, func(t *testing.T) {
48 got := normalizeImport(tt.input)
49 if got != tt.expected {
50 t.Errorf("normalizeImport(%q) = %q, want %q", tt.input, got, tt.expected)
51 }
52 })
53 }
54}
55
56func TestBuildFileIndex(t *testing.T) {
57 files := []FileInfo{

Callers

nothing calls this directly

Calls 1

normalizeImportFunction · 0.85

Tested by

no test coverage detected