We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c34ad4a commit b5c7162Copy full SHA for b5c7162
1 file changed
be/assert.go
@@ -8,6 +8,21 @@ import (
8
9
type Outcome string
10
11
+type Failer interface {
12
+ Fatal(args ...any)
13
+}
14
+
15
+func (o *Outcome) Run(t Failer, msg string, args ...any) {
16
+ if o == nil {
17
+ return
18
+ }
19
+ if len(args) > 0 {
20
+ msg = fmt.Sprintf(msg, args...)
21
22
+ fullMsg := fmt.Sprintf("%s: %s", msg, *o)
23
+ t.Fatal(fullMsg)
24
25
26
func failf(format string, args ...any) *Outcome {
27
str := fmt.Sprintf(format, args...)
28
return (*Outcome)(&str)
0 commit comments