test_support

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package test_support adds some testing utilities, especially for detecting when running on Bazel.

Index

Constants

View Source
const (
	ErrorTagBegin = "// --- ERROR BEGIN"
	ErrorTagEnd   = "// --- ERROR END"
)

Variables

This section is empty.

Functions

func ExtractExpectedError

func ExtractExpectedError(t *testing.T, r io.Reader) (_normalLines, _errorLines string, _err error)

ExtractExpectedError reads an input files and extracts the errors between the marked tags so that they can be compared to the output given by the code.

func LoadRunfile

func LoadRunfile(path string) (*files.LoadedFile, error)

ReadRunfile tries to read a file using the loading rules of |RunfilePath|.

func RunfilePath

func RunfilePath(path string) (string, error)

RunfilePath tries to find a testdata file in a build system agnostic way, working for both Bazel environments and default Go ones.

func Runfiles

func Runfiles(dir string) ([]string, error)

Runfiles returns a list of all the runfiles associated with this test that contains |dir|. Typical use is Runfiles("testdata")

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL