Skip to content

Commit 9fd32a8

Browse files
committed
test for os.PathError on non-existent netrc file
1 parent 2e5e1d1 commit 9fd32a8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

netrc/netrc_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"fmt"
1010
"io"
1111
"io/ioutil"
12+
"os"
1213
"strings"
1314
"testing"
1415
)
@@ -120,6 +121,13 @@ func TestParseFile(t *testing.T) {
120121
} else if !err.(*Error).BadDefaultOrder() {
121122
t.Error("expected BadDefaultOrder() to be true, got false")
122123
}
124+
125+
_, err = ParseFile("examples/this_file_doesnt_exist.netrc")
126+
if err == nil {
127+
t.Error("expected an error loading this_file_doesnt_exist.netrc, got none")
128+
} else if _, ok := err.(*os.PathError); !ok {
129+
t.Errorf("expected *os.Error, got %v", err)
130+
}
123131
}
124132

125133
func TestFindMachine(t *testing.T) {

0 commit comments

Comments
 (0)