mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
461 B
29 lines
461 B
package serial_test
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
. "v2ray.com/core/common/serial"
|
|
. "v2ray.com/ext/assert"
|
|
)
|
|
|
|
func TestToString(t *testing.T) {
|
|
assert := With(t)
|
|
|
|
s := "a"
|
|
data := []struct {
|
|
Value interface{}
|
|
String string
|
|
}{
|
|
{Value: s, String: s},
|
|
{Value: &s, String: s},
|
|
{Value: errors.New("t"), String: "t"},
|
|
{Value: []byte{'b', 'c'}, String: "[62,63]"},
|
|
}
|
|
|
|
for _, c := range data {
|
|
assert(ToString(c.Value), Equals, c.String)
|
|
}
|
|
}
|