1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-11 06:59:17 -04:00

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

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

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{})
}