-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtools_test.go
More file actions
38 lines (32 loc) · 848 Bytes
/
tools_test.go
File metadata and controls
38 lines (32 loc) · 848 Bytes
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
37
38
package virtual_device
import (
"errors"
"testing"
)
func TestConcatErrors_AllNil(t *testing.T) {
if err := concatErrors(nil, nil); err != nil {
t.Errorf("expected nil, got %v", err)
}
}
func TestConcatErrors_Empty(t *testing.T) {
if err := concatErrors(); err != nil {
t.Errorf("expected nil, got %v", err)
}
}
func TestConcatErrors_SingleError(t *testing.T) {
err := concatErrors(errors.New("boom"))
if err == nil || err.Error() != "boom" {
t.Errorf("expected 'boom', got %v", err)
}
}
func TestConcatErrors_MultipleErrors(t *testing.T) {
err := concatErrors(errors.New("a"), nil, errors.New("b"))
if err == nil || err.Error() != "a; b" {
t.Errorf("expected 'a; b', got %v", err)
}
}
func TestConcatErrors_SingleNil(t *testing.T) {
if err := concatErrors(nil); err != nil {
t.Errorf("expected nil, got %v", err)
}
}