Documentation
¶
Overview ¶
Package testutil provides shared test utilities for the git-vendor project. These helpers are designed for testing serialization (YAML/JSON) round-trips and field validation across multiple packages.
Index ¶
- func AssertEqual[T any](t *testing.T, got, want T, msg string)
- func AssertError(t *testing.T, err error, msg string)
- func AssertJSONContainsField(t *testing.T, v any, fieldName string)
- func AssertJSONOmitsField(t *testing.T, v any, fieldName string)
- func AssertJSONRoundTrip[T any](t *testing.T, original T)
- func AssertNoError(t *testing.T, err error, msg string)
- func AssertNotEqual[T any](t *testing.T, got, notWant T, msg string)
- func AssertYAMLContainsField(t *testing.T, v any, fieldName string)
- func AssertYAMLOmitsField(t *testing.T, v any, fieldName string)
- func AssertYAMLRoundTrip[T any](t *testing.T, original T)
- func BoolPtr(b bool) *bool
- func IntPtr(i int) *int
- func StrPtr(s string) *string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertEqual ¶
AssertEqual fails the test if got != want using reflect.DeepEqual.
func AssertError ¶
AssertError fails the test if err is nil.
func AssertJSONContainsField ¶
AssertJSONContainsField verifies a field is present in marshalled JSON output. Parses JSON into a map and recursively checks for key presence to avoid false positives from string values containing field-like patterns.
func AssertJSONOmitsField ¶
AssertJSONOmitsField verifies a field is not present in marshalled JSON output. Parses JSON into a map and recursively checks for key presence to avoid false positives from string values containing field-like patterns.
func AssertJSONRoundTrip ¶
AssertJSONRoundTrip marshals v to JSON and unmarshals back, failing if not equal. Uses reflect.DeepEqual for comparison.
func AssertNoError ¶
AssertNoError fails the test if err is not nil.
func AssertNotEqual ¶
AssertNotEqual fails the test if got == want using reflect.DeepEqual.
func AssertYAMLContainsField ¶
AssertYAMLContainsField verifies a field is present in marshalled YAML output. Parses YAML into a map and recursively checks for key presence to avoid false positives from string values containing field-like patterns.
func AssertYAMLOmitsField ¶
AssertYAMLOmitsField verifies a field is not present in marshalled YAML output. Parses YAML into a map and recursively checks for key presence to avoid false positives from string values containing field-like patterns.
func AssertYAMLRoundTrip ¶
AssertYAMLRoundTrip marshals v to YAML and unmarshals back, failing if not equal. Uses reflect.DeepEqual for comparison.
Types ¶
This section is empty.