Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 74c0818

Browse files
committed
gps: add unwrapVcsErr nil cause test
1 parent 8fecb95 commit 74c0818

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

internal/gps/source_errors_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2017 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package gps
6+
7+
import (
8+
"testing"
9+
10+
"github.com/Masterminds/vcs"
11+
)
12+
13+
func TestUnwrapVcsErrNonNil(t *testing.T) {
14+
for _, err := range []error{
15+
vcs.NewRemoteError("msg", nil, "out"),
16+
vcs.NewRemoteError("msg", nil, ""),
17+
vcs.NewRemoteError("", nil, "out"),
18+
vcs.NewRemoteError("", nil, ""),
19+
vcs.NewLocalError("msg", nil, "out"),
20+
vcs.NewLocalError("msg", nil, ""),
21+
vcs.NewLocalError("", nil, "out"),
22+
vcs.NewLocalError("", nil, ""),
23+
&vcs.RemoteError{},
24+
&vcs.LocalError{},
25+
} {
26+
if unwrapVcsErr(err) == nil {
27+
t.Errorf("unexpected nil error unwrapping: %#v", err)
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)