MCPcopy
hub / github.com/expr-lang/expr / TestEqualFormatting

Function TestEqualFormatting

internal/testify/assert/assertions_test.go:702–718  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

700}
701
702func TestEqualFormatting(t *testing.T) {
703 for i, currCase := range []struct {
704 equalWant string
705 equalGot string
706 msgAndArgs []interface{}
707 want string
708 }{
709 {equalWant: "want", equalGot: "got", want: "\tassertions.go:\\d+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n"},
710 {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+hello, world!\n"},
711 {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{123}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+123\n"},
712 {equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{struct{ a string }{"hello"}}, want: "\tassertions.go:[0-9]+: \n\t+Error Trace:\t\n\t+Error:\\s+Not equal:\\s+\n\\s+expected: \"want\"\n\\s+actual\\s+: \"got\"\n\\s+Diff:\n\\s+-+ Expected\n\\s+\\++ Actual\n\\s+@@ -1 \\+1 @@\n\\s+-want\n\\s+\\+got\n\\s+Messages:\\s+{a:hello}\n"},
713 } {
714 mockT := &bufferT{}
715 Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)
716 Regexp(t, regexp.MustCompile(currCase.want), mockT.buf.String(), "Case %d", i)
717 }
718}
719
720func TestFormatUnequalValues(t *testing.T) {
721 expected, actual := formatUnequalValues("foo", "bar")

Callers

nothing calls this directly

Calls 3

EqualFunction · 0.70
RegexpFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…