func NewTestConfig(t *testing.T, cexts []config.Configurer, langs []language.Language, args []string) *config.Config {
	c := config.New()
	fs := flag.NewFlagSet("test", flag.ContinueOnError)
	for _, lang := range langs {
		cexts = append(cexts, lang)
	}
	for _, cext := range cexts {
		cext.RegisterFlags(fs, "update", c)
	}
	if err := fs.Parse(args); err != nil {
		t.Fatal(err)
	}
	for _, cext := range cexts {
		if err := cext.CheckFlags(fs, c); err != nil {
			t.Fatal(err)
		}
	}
	return c
}
NewTestConfig returns a Config used for tests in any language extension.
cexts is a list of configuration extensions to use. langs is a list of
language extensions to use (languages are also configuration extensions,
but it may be convenient to keep them separate). args is a list of
command line arguments to apply. NewTestConfig calls t.Fatal if any
error is encountered while processing flags.
package testtools
import (
	"flag"
	"testing"
	"github.com/bazelbuild/bazel-gazelle/config"
	"github.com/bazelbuild/bazel-gazelle/language"
)