Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFiles ¶
CheckFiles checks that files in "dir" exist and have the content specified in "files". Files not listed in "files" are not tested, so extra files are allowed.
func CreateFiles ¶
CreateFiles creates a directory of test files. This is a more compact alternative to testdata directories. CreateFiles returns a canonical path to the directory and a function to call to clean up the directory after the test.
func NewTestConfig ¶
func NewTestConfig(t *testing.T, cexts []config.Configurer, langs []language.Language, args []string) *config.Config
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.
Types ¶
type FileSpec ¶
type FileSpec struct { // Path is a slash-separated path relative to the test directory. If Path // ends with a slash, it indicates a directory should be created // instead of a file. Path string // Symlink is a slash-separated path relative to the test directory. If set, // it indicates a symbolic link should be created with this path instead of a // file. Symlink string // Content is the content of the test file. Content string // NotExist asserts that no file at this path exists. // It is only valid in CheckFiles. NotExist bool }
FileSpec specifies the content of a test file.