Keep import selection evidence with its declaring source
This commit is contained in:
@@ -108,13 +108,14 @@ parent: true
|
||||
}
|
||||
defer func() { _ = access.close() }()
|
||||
state := importTraversal{
|
||||
access: access,
|
||||
policy: &acquisitionPolicy{importLimits: defaultImportLimits()},
|
||||
state: &acquisitionState{accounting: &importAccounting{}},
|
||||
tier: &tierAcquisitionState{visited: make(map[resourceIdentity]importRoute)},
|
||||
active: make(map[resourceIdentity]int),
|
||||
access: access,
|
||||
policy: &acquisitionPolicy{importLimits: defaultImportLimits()},
|
||||
state: &acquisitionState{accounting: &importAccounting{sources: 1}},
|
||||
tier: &tierAcquisitionState{visited: make(map[resourceIdentity]importRoute)},
|
||||
sources: sourceInfos(main.source),
|
||||
active: make(map[resourceIdentity]int),
|
||||
}
|
||||
if diagnostics := state.walkDeclarations(directory, declarations, 0, Keys("entry")); len(diagnostics) != 0 {
|
||||
if diagnostics := state.walkDeclarations(directory, declarations, 0, Keys("entry"), 0); len(diagnostics) != 0 {
|
||||
t.Fatalf("walk diagnostics = %#v", diagnostics)
|
||||
}
|
||||
|
||||
@@ -128,11 +129,11 @@ parent: true
|
||||
{path: alphaPath, destination: "/entry/collection"},
|
||||
{path: betaPath, destination: "/entry/collection"},
|
||||
}
|
||||
if len(state.sources) != len(wantSources) {
|
||||
t.Fatalf("import sources = %#v, want %d", state.sources, len(wantSources))
|
||||
if len(state.sources) != len(wantSources)+1 {
|
||||
t.Fatalf("sources = %#v, want %d including main", state.sources, len(wantSources)+1)
|
||||
}
|
||||
for index, want := range wantSources {
|
||||
got := state.sources[index]
|
||||
got := state.sources[index+1]
|
||||
if got.Path != canonicalTestPath(t, want.path) || got.Destination.String() != want.destination {
|
||||
t.Errorf("source %d = (%q, %q), want (%q, %q)", index, got.Path, got.Destination.String(), canonicalTestPath(t, want.path), want.destination)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user