testutil

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmpPaths = cmp.Options{
	cmp.Transformer("toSlash", filepath.ToSlash),
	cmpopts.SortSlices(func(a, b string) bool { return a < b }),
}

CmpPaths is a cmp.Option bundle that normalizes path separators to '/' and sorts string slices before comparison. This is ideal for comparing lists of file paths in a cross-platform, order-insensitive way.

Functions

func PathsMatch

func PathsMatch(t *testing.T, want, got []string, msgAndArgs ...interface{}) bool

PathsMatch asserts that two string slices containing file paths are equivalent, ignoring slice order and path separator differences (e.g., '\' vs '/').

It uses go-cmp for its powerful diffing capabilities and reports the failure using the testify/assert framework for consistent test output.

Returns true if the paths match, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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