1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
package vcs
import (
"errors"
"testing"
)
func TestNewRemoteError(t *testing.T) {
base := errors.New("Foo error")
out := "This is a test"
msg := "remote error msg"
e := NewRemoteError(msg, base, out)
switch e.(type) {
case *RemoteError:
// This is the right error type
default:
t.Error("Wrong error type returned from NewRemoteError")
}
}
func TestNewLocalError(t *testing.T) {
base := errors.New("Foo error")
out := "This is a test"
msg := "local error msg"
e := NewLocalError(msg, base, out)
switch e.(type) {
case *LocalError:
// This is the right error type
default:
t.Error("Wrong error type returned from NewLocalError")
}
}
|