|
@@ -2,13 +2,11 @@ package errors_test
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"io"
|
|
"io"
|
|
|
- "os"
|
|
|
|
|
"strings"
|
|
"strings"
|
|
|
"testing"
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
|
|
|
|
- "github.com/v2fly/v2ray-core/v4/common"
|
|
|
|
|
. "github.com/v2fly/v2ray-core/v4/common/errors"
|
|
. "github.com/v2fly/v2ray-core/v4/common/errors"
|
|
|
"github.com/v2fly/v2ray-core/v4/common/log"
|
|
"github.com/v2fly/v2ray-core/v4/common/log"
|
|
|
)
|
|
)
|
|
@@ -42,26 +40,17 @@ func TestError(t *testing.T) {
|
|
|
type e struct{}
|
|
type e struct{}
|
|
|
|
|
|
|
|
func TestErrorMessage(t *testing.T) {
|
|
func TestErrorMessage(t *testing.T) {
|
|
|
- pwd, err := os.Getwd()
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- t.Error(err)
|
|
|
|
|
- }
|
|
|
|
|
- moduleName, gmnErr := common.GetModuleName(pwd)
|
|
|
|
|
- if gmnErr != nil {
|
|
|
|
|
- t.Error(gmnErr)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
data := []struct {
|
|
data := []struct {
|
|
|
err error
|
|
err error
|
|
|
msg string
|
|
msg string
|
|
|
}{
|
|
}{
|
|
|
{
|
|
{
|
|
|
err: New("a").Base(New("b")).WithPathObj(e{}),
|
|
err: New("a").Base(New("b")).WithPathObj(e{}),
|
|
|
- msg: moduleName + "/common/errors_test: a > b",
|
|
|
|
|
|
|
+ msg: "common/errors_test: a > b",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
err: New("a").Base(New("b").WithPathObj(e{})),
|
|
err: New("a").Base(New("b").WithPathObj(e{})),
|
|
|
- msg: "a > " + moduleName + "/common/errors_test: b",
|
|
|
|
|
|
|
+ msg: "a > common/errors_test: b",
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
|
|
|