Skip to main content

AssertEqualWithSanitizedRegex

Sanitizes representations of protobufs in tests and asserts their equality.

def AssertEqualWithSanitizedRegex(
t: *testing.T,
expected: string,
actual: string
) - > null

Asserts that two strings are equal after sanitizing them by removing parts that match a predefined regular expression. This function is used in tests to compare representations of protobufs, ignoring variable parts like memory addresses or timestamps.

Parameters

NameTypeDescription
t*testing.TThe testing context provided by the Go testing framework, used to report test failures.
expectedstringThe expected string representation of a protobuf, which will be sanitized before comparison.
actualstringThe actual string representation of a protobuf, which will be sanitized before comparison.

Returns

TypeDescription
nullThis function does not return any value; it performs an assertion which will cause the test to fail if the sanitized strings are not equal.