2017-04-28 18:37:49 +00:00
|
|
|
package serial_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-02-16 20:31:50 +00:00
|
|
|
. "github.com/v2fly/v2ray-core/v4/common/serial"
|
2017-04-28 18:37:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetInstance(t *testing.T) {
|
|
|
|
p, err := GetInstance("")
|
2019-01-31 19:57:01 +00:00
|
|
|
if p != nil {
|
|
|
|
t.Error("expected nil instance, but got ", p)
|
|
|
|
}
|
|
|
|
if err == nil {
|
|
|
|
t.Error("expect non-nil error, but got nil")
|
|
|
|
}
|
2017-04-28 18:37:49 +00:00
|
|
|
}
|
2018-11-13 21:46:01 +00:00
|
|
|
|
|
|
|
func TestConvertingNilMessage(t *testing.T) {
|
|
|
|
x := ToTypedMessage(nil)
|
|
|
|
if x != nil {
|
|
|
|
t.Error("expect nil, but actually not")
|
|
|
|
}
|
|
|
|
}
|