File: parser_test.go

package info (click to toggle)
golang-github-dimonomid-ssh-config 0.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 248 kB
  • sloc: makefile: 25
file content (24 lines) | stat: -rw-r--r-- 430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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, false)
	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)
	}
}