Documentation ¶
Overview ¶
Package testutil contains common utilities to test Kythe libraries.
Index ¶
- func DeepEqual[T any](expected, got T, opts ...cmp.Option) error
- func Errorf(t testing.TB, msg string, err error, args ...any)
- func Fatalf(t testing.TB, msg string, err error, args ...any)
- func JSONEqual(expected, got []byte) error
- func RandBytes(bytes []byte)
- func RandStr(size int) string
- func SetFlag(t testing.TB, flagName string, value string)
- func TestFilePath(t *testing.T, path string) string
- func TrimmedEqual(got, want []byte) (bool, string)
- func YAMLEqual(expected, got []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶ added in v0.0.9
DeepEqual determines if expected is deeply equal to got, returning a detailed error if not. It is okay for expected and got to be protobuf message values.
func JSONEqual ¶ added in v0.0.30
JSONEqual compares two bytes assuming they are json, using encoding/json and DeepEqual.
func SetFlag ¶ added in v0.0.64
SetFlag sets a flag to a value for the duration of the test, resetting it to the flag's default value during cleanup.
func TestFilePath ¶ added in v0.0.29
TestFilePath takes a path and resolves it based on the testdir. If it cannot successfully do so, it calls t.Fatal and abandons.
func TrimmedEqual ¶ added in v0.0.29
TrimmedEqual compares two strings after collapsing irrelevant whitespace at the beginning or end of lines. It returns both a boolean indicating equality, as well as any relevant diff.
Types ¶
This section is empty.