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

Change-Id: I5a7fdb194011300b86a42f8dd8b8dfcf95e6d3d3
This commit is contained in:
Treehugger Robot 2020-06-01 16:58:01 +00:00 committed by Automerger Merge Worker
commit a034aecb73

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}