mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-23 02:26:49 -05:00
24 lines
380 B
Go
24 lines
380 B
Go
|
package errors_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/v2ray/v2ray-core/common/errors"
|
||
|
"github.com/v2ray/v2ray-core/testing/unit"
|
||
|
)
|
||
|
|
||
|
type MockError struct {
|
||
|
errors.ErrorCode
|
||
|
}
|
||
|
|
||
|
func (err MockError) Error() string {
|
||
|
return "This is a fake error."
|
||
|
}
|
||
|
|
||
|
func TestHasCode(t *testing.T) {
|
||
|
assert := unit.Assert(t)
|
||
|
|
||
|
err := MockError{ErrorCode: 101}
|
||
|
assert.Error(err).HasCode(101)
|
||
|
}
|