Documentation
¶
Overview ¶
Package extracttest provides structures to help create tabular tests for extractors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseTestScanInput ¶
func CloseTestScanInput(t *testing.T, si filesystem.ScanInput)
CloseTestScanInput takes a scan input generated by GenerateScanInputMock and closes the associated file handle
func GenerateScanInputMock ¶
func GenerateScanInputMock(t *testing.T, config ScanInputMockConfig) filesystem.ScanInput
GenerateScanInputMock will try to open the file locally, and fail if the file doesn't exist
func PackageCmpLess ¶ added in v0.2.0
PackageCmpLess is a comparator function for Packages, to be used in tests with cmp.Diff to disregard the order in which the Packages are reported.
Types ¶
type ContainsErrStr ¶
type ContainsErrStr struct {
Str string
}
ContainsErrStr is an error that matches other errors that contains `str` in their error string.
func (ContainsErrStr) Is ¶
func (e ContainsErrStr) Is(err error) bool
Is checks whether the input error contains the string in ContainsErrStr
type ScanInputMockConfig ¶
type ScanInputMockConfig struct {
// Path of the file ScanInput will read, relative to the ScanRoot
Path string
// FakeScanRoot allows you to set a custom scanRoot, can be relative or absolute,
// and will be translated to an absolute path
FakeScanRoot string
FakeFileInfo *fakefs.FakeFileInfo
}
ScanInputMockConfig is used to quickly configure building a mock ScanInput
type TestTableEntry ¶
type TestTableEntry struct {
Name string
InputConfig ScanInputMockConfig
WantPackages []*extractor.Package
WantErr error
}
TestTableEntry is a entry to pass to ExtractionTester