Preserve failing search candidate diagnostics
This commit is contained in:
@@ -457,10 +457,16 @@ func TestResolveSearchStopsOnReachedProbeError(t *testing.T) {
|
||||
statCalls++
|
||||
return nil, fs.ErrPermission
|
||||
}}
|
||||
_, diagnostics := resolveSearchSource(Source{}, ptrSearch(Paths(first, second)), "", false, discoveryDirectoryHelpers{}, probe)
|
||||
if len(diagnostics) != 1 || diagnostics[0].Code != CodeSourcePermission || diagnostics[0].Primary != nil || statCalls != 1 {
|
||||
selected, info, diagnostics := resolveSearchInput(SearchConfig("", Paths(first, second)), "source-3", discoveryDirectoryHelpers{}, probe)
|
||||
if len(diagnostics) != 1 || diagnostics[0].Code != CodeSourcePermission || statCalls != 1 {
|
||||
t.Fatalf("probe failure = %#v, stat calls = %d", diagnostics, statCalls)
|
||||
}
|
||||
if selected.kind != sourceFile || info == nil || info.Path != canonicalTestPath(t, first) || info.Label != first || info.Kind != SourceKindFile || info.ID != "source-3" {
|
||||
t.Fatalf("failed candidate evidence = %#v, %#v", selected, info)
|
||||
}
|
||||
if diagnostics[0].Primary == nil || diagnostics[0].Primary.SourceID != info.ID {
|
||||
t.Fatalf("failed candidate diagnostic does not identify its file: %#v", diagnostics)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveSearchLeavesLaterDirectoryUnresolvedAfterSelection(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user