We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 682befc commit 8aec034Copy full SHA for 8aec034
should/should.go
@@ -69,3 +69,20 @@ var (
69
StartWith = assertions.ShouldStartWith
70
Wrap = assertions.ShouldWrap
71
)
72
+
73
+// So is a variation on other such functions/methods in this module.
74
+// Since it is defined alongside all these assertion definitions it allows
75
+// performing assertions in tests with a single import of this package.
76
+// Example:
77
+// should.So(t, 1, should.Equal, 1)
78
+func So(t testingT, actual any, assertion assertions.SoFunc, expected ...any) {
79
+ if ok, result := assertions.So(actual, assertion, expected...); !ok {
80
+ t.Helper()
81
+ t.Errorf("\n%s", result)
82
+ }
83
+}
84
85
+type testingT interface {
86
+ Helper()
87
+ Errorf(string, ...any)
88
0 commit comments