File: errors_test.go

package info (click to toggle)
golang-github-masterminds-vcs-dev 1.12.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 216 kB
  • sloc: makefile: 37
file content (36 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (2)
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")
	}
}