Skip to content

Commit 40c97c0

Browse files
committed
Remove additional unused functionality
1 parent 09e844b commit 40c97c0

File tree

2 files changed

+0
-92
lines changed

2 files changed

+0
-92
lines changed

expect/expect_opt.go

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ package expect
1717
import (
1818
"bytes"
1919
"errors"
20-
"io"
2120
"os"
2221
"regexp"
2322
"strings"
24-
"syscall"
2523
"time"
2624
)
2725

@@ -224,38 +222,3 @@ func String(strs ...string) Opt {
224222
return nil
225223
}
226224
}
227-
228-
// Error adds an Expect condition to exit if reading from Console's tty returns
229-
// one of the provided errors.
230-
func Error(errs ...error) Opt {
231-
return func(opts *Opts) error {
232-
for _, err := range errs {
233-
opts.Matchers = append(opts.Matchers, &errorMatcher{
234-
err: err,
235-
})
236-
}
237-
return nil
238-
}
239-
}
240-
241-
// EOF adds an Expect condition to exit if io.EOF is returned from reading
242-
// Console's tty.
243-
func EOF(opts *Opts) error {
244-
return Error(io.EOF)(opts)
245-
}
246-
247-
// PTSClosed adds an Expect condition to exit if we get an
248-
// "read /dev/ptmx: input/output error" error which can occur
249-
// on Linux while reading from the ptm after the pts is closed.
250-
// Further Reading:
251-
// https://github.com/kr/pty/issues/21#issuecomment-129381749
252-
func PTSClosed(opts *Opts) error {
253-
opts.Matchers = append(opts.Matchers, &pathErrorMatcher{
254-
pathError: os.PathError{
255-
Op: "read",
256-
Path: "/dev/ptmx",
257-
Err: syscall.Errno(0x5),
258-
},
259-
})
260-
return nil
261-
}

expect/expect_opt_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package expect_test
1616

1717
import (
1818
"bytes"
19-
"io"
2019
"testing"
2120

2221
"github.com/stretchr/testify/require"
@@ -82,60 +81,6 @@ func TestExpectOptString(t *testing.T) {
8281
}
8382
}
8483

85-
func TestExpectOptError(t *testing.T) {
86-
t.Parallel()
87-
88-
tests := []struct {
89-
title string
90-
opt Opt
91-
data error
92-
expected bool
93-
}{
94-
{
95-
"No args",
96-
Error(),
97-
io.EOF,
98-
false,
99-
},
100-
{
101-
"Single arg",
102-
Error(io.EOF),
103-
io.EOF,
104-
true,
105-
},
106-
{
107-
"Multiple arg",
108-
Error(io.ErrShortWrite, io.EOF),
109-
io.EOF,
110-
true,
111-
},
112-
{
113-
"No matches",
114-
Error(io.ErrShortWrite),
115-
io.EOF,
116-
false,
117-
},
118-
}
119-
120-
for _, test := range tests {
121-
test := test
122-
t.Run(test.title, func(t *testing.T) {
123-
t.Parallel()
124-
125-
var options Opts
126-
err := test.opt(&options)
127-
require.Nil(t, err)
128-
129-
matcher := options.Match(test.data)
130-
if test.expected {
131-
require.NotNil(t, matcher)
132-
} else {
133-
require.Nil(t, matcher)
134-
}
135-
})
136-
}
137-
}
138-
13984
func TestExpectOptAll(t *testing.T) {
14085
t.Parallel()
14186

0 commit comments

Comments
 (0)