Skip to content

Commit

Permalink
added TestAs_betterFormat
Browse files Browse the repository at this point in the history
Signed-off-by: Hedzr Yeh <hedzrz@gmail.com>
  • Loading branch information
hedzr committed Feb 26, 2023
1 parent cda071d commit 786d0f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions causes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package errors
import (
"fmt"
"io"
"strconv"
"testing"
)

Expand All @@ -17,6 +18,16 @@ func TestAs_e1(t *testing.T) {
}
}

func TestAs_betterFormat(t *testing.T) {
var err = New("Have errors").WithErrors(io.EOF, io.ErrShortWrite, io.ErrNoProgress)
t.Logf("%v\n", err)

var nestNestErr = New("Errors FOUND:").WithErrors(err, io.EOF)
var nnnErr = New("Nested Errors:").WithErrors(nestNestErr, strconv.ErrRange)
t.Logf("%v\n", nnnErr)
t.Logf("%+v\n", nnnErr)
}

func TestCauses2_WithCode(t *testing.T) {
err := &causes2{
Code: Internal,
Expand Down

0 comments on commit 786d0f1

Please sign in to comment.