You've already forked ssh_config
mirror of
https://github.com/wavetermdev/ssh_config.git
synced 2026-04-22 15:25:24 -07:00
25 lines
423 B
Go
25 lines
423 B
Go
|
|
package ssh_config
|
||
|
|
|
||
|
|
import (
|
||
|
|
"errors"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
type errReader struct {
|
||
|
|
}
|
||
|
|
|
||
|
|
func (b *errReader) Read(p []byte) (n int, err error) {
|
||
|
|
return 0, errors.New("read error occurred")
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestIOError(t *testing.T) {
|
||
|
|
buf := &errReader{}
|
||
|
|
_, err := Decode(buf)
|
||
|
|
if err == nil {
|
||
|
|
t.Fatal("expected non-nil err, got nil")
|
||
|
|
}
|
||
|
|
if err.Error() != "read error occurred" {
|
||
|
|
t.Errorf("expected read error msg, got %v", err)
|
||
|
|
}
|
||
|
|
}
|