Documentation ¶
Overview ¶
Package fakeloader contains a hermetic loader implementation that does not depend on any other systems and can be used in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeLoader ¶
func NewFakeLoader(pkgs map[string][]string, files, generated map[string]string, exportFor ExportForFunc) loader.Loader
NewFakeLoader returns a Loader that can be used in tests. It works in the same way as loader returned from NewLoader, except it fakes expensive/flaky dependencies (e.g. executing commands).
pkgs maps target rule names (e.g. "//base/go:flag") to list of files in that package (e.g. "net/proto2/go/open2opaque/testdata/dummycmd.go"). File paths should be in the form expected by blaze, e.g. "//net/proto2/go/open2opaque/testdata:dummy.go". Names of test packages should have "_test" suffix.
files maps all files (e.g. "//test/pkg:updated.go"), referenced by the pkgs map, to their content. generated maps generated files (e.g. "//test/pkg:generated.go"), referenced by the pkgs map, to ther content.
Unlike the loader returned by NewLoader, the fake loader is inexpensive. It's intended that multiple fake loaders are created (perhaps one per test).
Types ¶
type ExportForFunc ¶
ExportForFunc is a caller-supplied function that returns the export data (.x file) for the package with the specified import path.