Simplify empty import selection evidence
This commit is contained in:
@@ -35,7 +35,7 @@ func TestSourceInfoDestinationConversion(t *testing.T) {
|
||||
}
|
||||
internal := engineSourceInfoFromLoad(t, path, "source-1", options)
|
||||
converted := fromEngineSourceInfo(internal)
|
||||
if converted.Destination.String() != destination.String() || converted.PlacementMode != PlacementModeSequenceItem || converted.DestinationUnresolved {
|
||||
if converted.Destination.String() != destination.String() || converted.PlacementMode != PlacementModeSequenceItem || converted.DestinationIsFallback {
|
||||
t.Fatalf("public source evidence = %#v", converted)
|
||||
}
|
||||
}
|
||||
@@ -70,18 +70,15 @@ func TestImportSelectionConversion(t *testing.T) {
|
||||
file := writeRecordConfig(t, "configkit:\n imports:\n - glob: absent/*.yml\nvalue: main\n")
|
||||
internal := engineSourceInfoFromLoad(t, file, "source-1", engine.Options[recordConfig]{Imports: true})
|
||||
converted := fromEngineSourceInfo(internal)
|
||||
if len(converted.ImportSelections) != 1 || converted.ImportSelections[0].Path.String() != "/configkit/imports/0" ||
|
||||
converted.ImportSelections[0].Location.SourceID != internal.ID || converted.ImportSelections[0].Location.Line != 3 ||
|
||||
converted.ImportSelections[0].Selector != ImportSelectorGlob || converted.ImportSelections[0].Outcome != ImportSelectionNone {
|
||||
t.Fatalf("converted selection evidence = %#v", converted.ImportSelections)
|
||||
if len(converted.EmptyImportSelections) != 1 || converted.EmptyImportSelections[0].Path.String() != "/configkit/imports/0" ||
|
||||
converted.EmptyImportSelections[0].Location.SourceID != internal.ID || converted.EmptyImportSelections[0].Location.Line != 3 ||
|
||||
converted.EmptyImportSelections[0].Selector != ImportSelectorGlob {
|
||||
t.Fatalf("converted selection evidence = %#v", converted.EmptyImportSelections)
|
||||
}
|
||||
if converted.ImportSelections[0].Outcome != ImportSelectionNone {
|
||||
t.Fatalf("source selection outcome = %q", converted.ImportSelections[0].Outcome)
|
||||
}
|
||||
if fromEngineImportSelections(nil) != nil {
|
||||
if fromEngineEmptyImportSelections(nil) != nil {
|
||||
t.Fatal("converting nil engine selections returned a non-nil slice")
|
||||
}
|
||||
if fromEngineImportSelections([]engine.ImportSelectionForFacade{}) == nil {
|
||||
if fromEngineEmptyImportSelections([]engine.ImportSelectionForFacade{}) == nil {
|
||||
t.Fatal("converting an empty engine selection slice returned nil")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user