{"modulePath":"github.com/stackb/bazel_difftools","version":"v0.3.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testtools\n\n## Functions\n\n```go\nfunc CheckFiles(t *testing.T, dir string, files []FileSpec)\n```\nCheckFiles 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.\n\n```go\nfunc CreateFiles(t *testing.T, files []FileSpec) (dir string, cleanup func())\n```\nCreateFiles 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.\n\n```go\nfunc TestAquerydiffGenerationOnPath(t *testing.T, args *TestAquerydiffGenerationArgs)\n```\nTestAquerydiffGenerationOnPath runs a full aquerydiff binary on a testdata directory. With a test data directory of the form: └── \\\u003ctestDataPath\u003e\n\n\t└── some_test\n\t    ├── WORKSPACE\n\t    ├── README.md --\u003e README describing what the test does.\n\t    ├── arguments.txt --\u003e newline delimited list of arguments to pass in (ignored if empty).\n\t    ├── expectedStdout.txt --\u003e Expected stdout for this test.\n\t    ├── expectedStderr.txt --\u003e Expected stderr for this test.\n\t    ├── expectedExitCode.txt --\u003e Expected exit code for this test.\n\t    └── app\n\t        └── sourceFile.foo\n\t        └── BUILD.in --\u003e BUILD file prior to running aquerydiff.\n\t        └── BUILD.out --\u003e BUILD file expected after running aquerydiff.\n\n## Types\n\n```go\ntype FileSpec struct {\n\t// Path is a slash-separated path relative to the test directory. If Path\n\t// ends with a slash, it indicates a directory should be created\n\t// instead of a file.\n\tPath string\n\n\t// Symlink is a slash-separated path relative to the test directory. If set,\n\t// it indicates a symbolic link should be created with this path instead of a\n\t// file.\n\tSymlink string\n\n\t// Content is the content of the test file.\n\tContent string\n\n\t// NotExist asserts that no file at this path exists.\n\t// It is only valid in CheckFiles.\n\tNotExist bool\n}\n```\nFileSpec specifies the content of a test file.\n\n```go\ntype TestAquerydiffGenerationArgs struct {\n\t// Name is the name of the test.\n\tName string\n\t// TestDataPathAbsolute is the absolute path to the test data directory.\n\t// For example, /home/user/workspace/path/to/test_data/my_testcase.\n\tTestDataPathAbsolute string\n\t// TestDataPathRealtive is the workspace relative path to the test data directory.\n\t// For example, path/to/test_data/my_testcase.\n\tTestDataPathRelative string\n\t// AquerydiffBinaryPath is the workspace relative path to the location of the aquerydiff binary\n\t// we want to test.\n\tAquerydiffBinaryPath string\n\n\t// BuildInSuffix is the suffix for all test input build files. Includes the \".\".\n\t// Default: \".in\", so input BUILD files should be named BUILD.in.\n\tBuildInSuffix string\n\n\t// BuildOutSuffix is the suffix for all test output build files. Includes the \".\".\n\t// Default: \".out\", so out BUILD files should be named BUILD.out.\n\tBuildOutSuffix string\n\n\t// Timeout is the duration after which the generation process will be killed.\n\tTimeout time.Duration\n}\n```\n\n","path":"github.com/stackb/bazel_difftools/pkg/testtools","name":"testtools","synopsis":"","isRedistributable":true}
