test: fix failed tests after code changes

This commit is contained in:
yusing
2025-05-05 20:05:47 +08:00
parent 62d3d200e6
commit b8c0961de3
6 changed files with 16 additions and 18 deletions

View File

@@ -37,11 +37,11 @@ func (err *baseError) Subjectf(format string, args ...any) Error {
}
func (err baseError) With(extra error) Error {
return &nestedError{err.Err, []error{extra}}
return &nestedError{&err, []error{extra}}
}
func (err baseError) Withf(format string, args ...any) Error {
return &nestedError{err.Err, []error{fmt.Errorf(format, args...)}}
return &nestedError{&err, []error{fmt.Errorf(format, args...)}}
}
func (err *baseError) Error() string {

View File

@@ -45,11 +45,11 @@ func TestFormatting(t *testing.T) {
func TestMultiError(t *testing.T) {
err := testMultiErr{[]error{testErr{}, testErr{}}}
plain := Plain(err)
if string(plain) != "test error\ntest error" {
if string(plain) != "test error\ntest error\n" {
t.Errorf("expected test error, got %s", string(plain))
}
md := Markdown(err)
if string(md) != "**test error**\n**test error**" {
if string(md) != "**test error**\n**test error**\n" {
t.Errorf("expected test error, got %s", string(md))
}
}