-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrorlists_test.go
32 lines (27 loc) · 936 Bytes
/
errorlists_test.go
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
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Portions copyright 2013 Seth W. Klein.
package errors_test
import (
"sethwklein.net/go/errors"
"testing"
)
func TestNewEqualList(t *testing.T) {
// Different allocations should not be equal.
if errors.Append(errors.New("ab"), errors.New("cd")) == errors.Append(errors.New("ab"), errors.New("cd")) {
t.Errorf(`Append(New("ab"), New("cd")) == Append(New("ab"), New("cd"))`)
}
// Same allocation should be equal to itself (not crash).
err := errors.Append(errors.New("jk"), errors.New("lm"))
if err != err {
t.Errorf(`err != err`)
}
}
func TestErrorMethodList(t *testing.T) {
err := errors.Append(errors.New("ab"), errors.New("cd"))
if err.Error() != "ab"+"\n"+"cd" {
t.Errorf(`Append(New("ab"), New("cd")) = %q, want %q`,
err.Error(), "ab\ncd")
}
}