Skip to content

Commit 4e4f3e2

Browse files
committed
Remove unused matchers
1 parent e76ad95 commit 4e4f3e2

File tree

1 file changed

+0
-85
lines changed

1 file changed

+0
-85
lines changed

expect/expect_opt.go

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ package expect
1616

1717
import (
1818
"bytes"
19-
"errors"
20-
"os"
21-
"regexp"
2219
"strings"
2320
"time"
2421
)
@@ -62,70 +59,6 @@ type Matcher interface {
6259
Criteria() interface{}
6360
}
6461

65-
// callbackMatcher fulfills the Matcher and CallbackMatcher interface to match
66-
// using its embedded matcher and provide a callback function.
67-
type callbackMatcher struct {
68-
f ConsoleCallback
69-
matcher Matcher
70-
}
71-
72-
func (cm *callbackMatcher) Match(v interface{}) bool {
73-
return cm.matcher.Match(v)
74-
}
75-
76-
func (cm *callbackMatcher) Criteria() interface{} {
77-
return cm.matcher.Criteria()
78-
}
79-
80-
func (cm *callbackMatcher) Callback(buf *bytes.Buffer) error {
81-
cb, ok := cm.matcher.(CallbackMatcher)
82-
if ok {
83-
err := cb.Callback(buf)
84-
if err != nil {
85-
return err
86-
}
87-
}
88-
err := cm.f(buf)
89-
if err != nil {
90-
return err
91-
}
92-
return nil
93-
}
94-
95-
// errorMatcher fulfills the Matcher interface to match a specific error.
96-
type errorMatcher struct {
97-
err error
98-
}
99-
100-
func (em *errorMatcher) Match(v interface{}) bool {
101-
err, ok := v.(error)
102-
if !ok {
103-
return false
104-
}
105-
return errors.Is(err, em.err)
106-
}
107-
108-
func (em *errorMatcher) Criteria() interface{} {
109-
return em.err
110-
}
111-
112-
// pathErrorMatcher fulfills the Matcher interface to match a specific os.PathError.
113-
type pathErrorMatcher struct {
114-
pathError os.PathError
115-
}
116-
117-
func (em *pathErrorMatcher) Match(v interface{}) bool {
118-
pathError, ok := v.(*os.PathError)
119-
if !ok {
120-
return false
121-
}
122-
return *pathError == em.pathError
123-
}
124-
125-
func (em *pathErrorMatcher) Criteria() interface{} {
126-
return em.pathError
127-
}
128-
12962
// stringMatcher fulfills the Matcher interface to match strings against a given
13063
// bytes.Buffer.
13164
type stringMatcher struct {
@@ -147,24 +80,6 @@ func (sm *stringMatcher) Criteria() interface{} {
14780
return sm.str
14881
}
14982

150-
// regexpMatcher fulfills the Matcher interface to match Regexp against a given
151-
// bytes.Buffer.
152-
type regexpMatcher struct {
153-
re *regexp.Regexp
154-
}
155-
156-
func (rm *regexpMatcher) Match(v interface{}) bool {
157-
buf, ok := v.(*bytes.Buffer)
158-
if !ok {
159-
return false
160-
}
161-
return rm.re.Match(buf.Bytes())
162-
}
163-
164-
func (rm *regexpMatcher) Criteria() interface{} {
165-
return rm.re
166-
}
167-
16883
// allMatcher fulfills the Matcher interface to match a group of ExpectOpt
16984
// against any value.
17085
type allMatcher struct {

0 commit comments

Comments
 (0)