-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherrors_join_test.go
More file actions
46 lines (41 loc) · 922 Bytes
/
errors_join_test.go
File metadata and controls
46 lines (41 loc) · 922 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
39
40
41
42
43
44
45
46
// Copyright (c) 2023 Benjamin Borbe All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package errors_test
import (
"errors"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
liberrors "github.com/bborbe/errors"
)
var _ = Describe("Join", func() {
var err error
var input []error
JustBeforeEach(func() {
err = liberrors.Join(input...)
})
Context("no errors", func() {
BeforeEach(func() {
input = []error{}
})
It("returns error", func() {
Expect(err).To(BeNil())
})
})
Context("multiple errors", func() {
BeforeEach(func() {
input = []error{
errors.New("a"),
errors.New("b"),
errors.New("c"),
}
})
It("returns error", func() {
Expect(err).NotTo(BeNil())
})
It("returns error", func() {
Expect(err).NotTo(BeNil())
Expect(err.Error()).To(Equal("[\na\nb\nc\n]"))
})
})
})