Feat: core.ToContext(ctx, v) for ctx initialization (#852)

This commit is contained in:
rurirei authored and GitHub committed 2021-04-04 19:28:00 +08:00
1 parent 0dcd1f4992
commit aa40b8b835
3 files changed
+31 -8

No files matched your search

+12 -1
View File
@@ -7,7 +7,7 @@ import (
. "github.com/v2fly/v2ray-core/v4"
)
func TestContextPanic(t *testing.T) {
func TestFromContextPanic(t *testing.T) {
defer func() {
r := recover()
if r == nil {
@@ -17,3 +17,14 @@ func TestContextPanic(t *testing.T) {
MustFromContext(context.Background())
}
func TestToContextPanic(t *testing.T) {
defer func() {
r := recover()
if r == nil {
t.Error("expect panic, but nil")
}
}()
MustToContext(context.Background(), &Instance{})
}