mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-10-14 04:54:03 -04:00
more test cases
This commit is contained in:
28
common/serial/string_test.go
Normal file
28
common/serial/string_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user