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 TestAquerydiffGenerationOnPath ¶
func TestAquerydiffGenerationOnPath(t *testing.T, args *TestAquerydiffGenerationArgs)
TestAquerydiffGenerationOnPath runs a full aquerydiff binary on a testdata directory. With a test data directory of the form: └── <testDataPath>
└── some_test
├── WORKSPACE
├── README.md --> README describing what the test does.
├── arguments.txt --> newline delimited list of arguments to pass in (ignored if empty).
├── expectedStdout.txt --> Expected stdout for this test.
├── expectedStderr.txt --> Expected stderr for this test.
├── expectedExitCode.txt --> Expected exit code for this test.
└── app
└── sourceFile.foo
└── BUILD.in --> BUILD file prior to running aquerydiff.
└── BUILD.out --> BUILD file expected after running aquerydiff.
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.
type TestAquerydiffGenerationArgs ¶
type TestAquerydiffGenerationArgs struct {
// Name is the name of the test.
Name string
// TestDataPathAbsolute is the absolute path to the test data directory.
// For example, /home/user/workspace/path/to/test_data/my_testcase.
TestDataPathAbsolute string
// TestDataPathRealtive is the workspace relative path to the test data directory.
// For example, path/to/test_data/my_testcase.
TestDataPathRelative string
// AquerydiffBinaryPath is the workspace relative path to the location of the aquerydiff binary
// we want to test.
AquerydiffBinaryPath string
// BuildInSuffix is the suffix for all test input build files. Includes the ".".
// Default: ".in", so input BUILD files should be named BUILD.in.
BuildInSuffix string
// BuildOutSuffix is the suffix for all test output build files. Includes the ".".
// Default: ".out", so out BUILD files should be named BUILD.out.
BuildOutSuffix string
// Timeout is the duration after which the generation process will be killed.
Timeout time.Duration
}
Click to show internal directories.
Click to hide internal directories.