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

Function TestDepsNormalizeImport

scanner/deps_test.go:525–546  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

523}
524
525func TestDepsNormalizeImport(t *testing.T) {
526 tests := []struct {
527 name string
528 imp string
529 want string
530 }{
531 {name: "trims quotes", imp: "\"pkg/util\"", want: "pkg/util"},
532 {name: "python dotted path", imp: "app.core.config", want: filepath.Join("app", "core", "config")},
533 {name: "crate path", imp: "crate::net::http", want: filepath.Join("net", "http")},
534 {name: "super path", imp: "super::service::api", want: filepath.Join("super", "service", "api")},
535 {name: "already slash path", imp: "src/util", want: "src/util"},
536 }
537
538 for _, tt := range tests {
539 t.Run(tt.name, func(t *testing.T) {
540 got := normalizeImport(tt.imp)
541 if got != tt.want {
542 t.Fatalf("normalizeImport(%q): want %q, got %q", tt.imp, tt.want, got)
543 }
544 })
545 }
546}
547
548func TestDepsResolveRelative(t *testing.T) {
549 handlerPath := filepath.FromSlash("pkg/api/handler.go")

Callers

nothing calls this directly

Calls 1

normalizeImportFunction · 0.85

Tested by

no test coverage detected