@@ -20,22 +20,22 @@ import (
20
20
"time"
21
21
)
22
22
23
- // Opt allows settings Expect options.
24
- type Opt func (* Opts ) error
23
+ // ExpectOpt allows settings Expect options.
24
+ type ExpectOpt func (* ExpectOpts ) error
25
25
26
- // ConsoleCallback is a callback function to execute if a match is found for
26
+ // Callback is a callback function to execute if a match is found for
27
27
// the chained matcher.
28
- type ConsoleCallback func (buf * bytes.Buffer ) error
28
+ type Callback func (buf * bytes.Buffer ) error
29
29
30
- // Opts provides additional options on Expect.
31
- type Opts struct {
30
+ // ExpectOpts provides additional options on Expect.
31
+ type ExpectOpts struct {
32
32
Matchers []Matcher
33
33
ReadTimeout * time.Duration
34
34
}
35
35
36
36
// Match sequentially calls Match on all matchers in ExpectOpts and returns the
37
37
// first matcher if a match exists, otherwise nil.
38
- func (eo Opts ) Match (v interface {}) Matcher {
38
+ func (eo ExpectOpts ) Match (v interface {}) Matcher {
39
39
for _ , matcher := range eo .Matchers {
40
40
if matcher .Match (v ) {
41
41
return matcher
@@ -83,7 +83,7 @@ func (sm *stringMatcher) Criteria() interface{} {
83
83
// allMatcher fulfills the Matcher interface to match a group of ExpectOpt
84
84
// against any value.
85
85
type allMatcher struct {
86
- options Opts
86
+ options ExpectOpts
87
87
}
88
88
89
89
func (am * allMatcher ) Match (v interface {}) bool {
@@ -109,9 +109,9 @@ func (am *allMatcher) Criteria() interface{} {
109
109
110
110
// All adds an Expect condition to exit if the content read from Console's tty
111
111
// matches all of the provided ExpectOpt, in any order.
112
- func All (expectOpts ... Opt ) Opt {
113
- return func (opts * Opts ) error {
114
- var options Opts
112
+ func All (expectOpts ... ExpectOpt ) ExpectOpt {
113
+ return func (opts * ExpectOpts ) error {
114
+ var options ExpectOpts
115
115
for _ , opt := range expectOpts {
116
116
if err := opt (& options ); err != nil {
117
117
return err
@@ -127,8 +127,8 @@ func All(expectOpts ...Opt) Opt {
127
127
128
128
// String adds an Expect condition to exit if the content read from Console's
129
129
// tty contains any of the given strings.
130
- func String (strs ... string ) Opt {
131
- return func (opts * Opts ) error {
130
+ func String (strs ... string ) ExpectOpt {
131
+ return func (opts * ExpectOpts ) error {
132
132
for _ , str := range strs {
133
133
opts .Matchers = append (opts .Matchers , & stringMatcher {
134
134
str : str ,
0 commit comments