Merge "Improved formatting of a module list in a panic message." am: a91b64d3ee

Change-Id: I10a306bd9bd966d10814e8a220aa47e081daeb10
This commit is contained in:
Treehugger Robot 2020-06-01 16:32:51 +00:00 committed by Automerger Merge Worker
commit 31771f8f14

View file

@ -18,6 +18,7 @@ import (
"fmt"
"path/filepath"
"regexp"
"sort"
"strings"
"testing"
@ -122,9 +123,10 @@ func (ctx *TestContext) ModuleForTests(name, variant string) TestingModule {
ctx.VisitAllModules(func(m blueprint.Module) {
allModuleNames = append(allModuleNames, m.(Module).Name()+"("+ctx.ModuleSubDir(m)+")")
})
sort.Strings(allModuleNames)
panic(fmt.Errorf("failed to find module %q variant %q."+
"\nall modules: %v", name, variant, allModuleNames))
panic(fmt.Errorf("failed to find module %q variant %q. All modules:\n %s",
name, variant, strings.Join(allModuleNames, "\n ")))
}
return TestingModule{module}