Skip to content

Commit

Permalink
fixing go test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
hedzr committed Sep 25, 2020
1 parent b8b69cc commit 58a556a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
6 changes: 6 additions & 0 deletions errors_go1.13_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ package errors

import (
errorsstd "errors"
"fmt"

// pkgerrors "github.com/pkg/errors"
"io"
"os"
"testing"
)

func geneof13() error {
return fmt.Errorf("xxx %w wrapped at go1.%v+", io.EOF, 13)
}

func Test1go113(t *testing.T) {
var err error

Expand Down
25 changes: 6 additions & 19 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
package errors

import (
"fmt"
"github.com/pkg/errors"
"io"
"os"
"testing"
Expand All @@ -14,13 +12,9 @@ func geneof() error {
return io.EOF
}

func geneof2() error {
return errors.Wrap(io.EOF, "xx")
}

func geneof13() error {
return fmt.Errorf("xxx %w wrapped at go1.%v+", io.EOF, 13)
}
//func geneof2() error {
// return pkgerrors.Wrap(io.EOF, "xx")
//}

func geneofx() error {
return WithCause(io.EOF, "text")
Expand Down Expand Up @@ -206,14 +200,7 @@ func Test1(t *testing.T) {
var err error

err = geneof()
if errors.Cause(err) == io.EOF {
t.Logf("ok: %v", err)
} else {
t.Fatal("expect it is a EOF")
}

err = geneof2()
if errors.Cause(err) == io.EOF {
if Cause(err) == io.EOF {
t.Logf("ok: %v", err)
} else {
t.Fatal("expect it is a EOF")
Expand All @@ -238,7 +225,7 @@ func Test2(t *testing.T) {
var err error

err = geneofx()
if errors.Cause(err) == io.EOF {
if Cause(err) == io.EOF {
t.Logf("ok: %v", err)
} else {
t.Fatal("expect it is a EOF")
Expand All @@ -250,7 +237,7 @@ func Test2(t *testing.T) {
}

err = geneofxs()
if errors.Cause(err) == io.EOF {
if Cause(err) == io.EOF {
t.Logf("ok: %v", err)
} else {
t.Fatal("expect it is a EOF")
Expand Down

0 comments on commit 58a556a

Please sign in to comment.