...
1 package matchers_test
2
3 import (
4 "fmt"
5 "os"
6 "testing"
7
8 . "github.com/onsi/ginkgo/v2"
9 . "github.com/onsi/gomega"
10 "github.com/onsi/gomega/internal/gutil"
11 )
12
13 type myStringer struct {
14 a string
15 }
16
17 func (s *myStringer) String() string {
18 return s.a
19 }
20
21 type StringAlias string
22
23 type myCustomType struct {
24 s string
25 n int
26 f float32
27 arr []string
28 }
29
30 func Test(t *testing.T) {
31 RegisterFailHandler(Fail)
32 RunSpecs(t, "Gomega Matchers")
33 }
34
35 func readFileContents(filePath string) []byte {
36 f := openFile(filePath)
37 b, err := gutil.ReadAll(f)
38 if err != nil {
39 panic(fmt.Errorf("failed to read file contents: %v", err))
40 }
41 return b
42 }
43
44 func openFile(filePath string) *os.File {
45 f, err := os.Open(filePath)
46 if err != nil {
47 panic(fmt.Errorf("failed to open file: %v", err))
48 }
49 return f
50 }
51
View as plain text