Documentation
¶
Overview ¶
Package datadiff provides test assertions for comparing slices of structs, with rich tabular diff output that highlights row and column mismatches.
Inspired by github.com/MrPowers/chispa for Python DataFrames.
Index ¶
Constants ¶
const Version = "0.1.0-dev"
Version is the current module version.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
Assert compares listA and listB and reports differences through t. Both arguments must be slices of the same struct type.
By default, comparison is strict: rows must appear in the same order and both lists must have equal length. Pass IgnoreOrder and/or IgnoreLengths to relax those constraints.
Assert calls t.Fatalf for programmer errors (invalid flags or invalid inputs) and t.Errorf for data mismatches.
Returns true if the lists are equal under the given flags, false otherwise.
Types ¶
type Flag ¶
type Flag int
Flag controls comparison behavior in Assert.
const ( // IgnoreOrder compares lists without regard to element position. // Rows are matched by finding the closest counterpart in the other list. IgnoreOrder Flag = iota + 1 // IgnoreLengths allows lists of different lengths. // Extra rows are reported in the diff output but do not cause the // assertion to fail. Without this flag, differing lengths are a failure. IgnoreLengths )