z_error_1_filetest.gno

0.51 Kb ยท 33 lines
 1package main
 2
 3import (
 4	"errors"
 5	"strings"
 6
 7	"gno.land/p/jeronimoalbi/expect"
 8)
 9
10var (
11	output  strings.Builder
12	t       = expect.MockTestingT(&output)
13	testErr = errors.New("test")
14)
15
16func main() {
17	expect.Func(t, func() error {
18		return testErr
19	}).ToFail().WithError(errors.New("foo"))
20
21	expect.Func(t, func() error {
22		return testErr
23	}).ToFail().Not().WithError(testErr)
24
25	println(output.String())
26}
27
28// Output:
29// Expected errors to match
30// Got: test
31// Want: foo
32// Expected errors to be different
33// Got: test