2018-10-21 14:33:08 -04:00
|
|
|
package core_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
2021-02-16 15:31:50 -05:00
|
|
|
. "github.com/v2fly/v2ray-core/v4"
|
2018-10-21 14:33:08 -04:00
|
|
|
)
|
|
|
|
|
2021-04-04 07:28:00 -04:00
|
|
|
func TestFromContextPanic(t *testing.T) {
|
2018-10-21 14:33:08 -04:00
|
|
|
defer func() {
|
|
|
|
r := recover()
|
|
|
|
if r == nil {
|
|
|
|
t.Error("expect panic, but nil")
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
MustFromContext(context.Background())
|
|
|
|
}
|
2021-04-04 07:28:00 -04:00
|
|
|
|
|
|
|
func TestToContextPanic(t *testing.T) {
|
|
|
|
defer func() {
|
|
|
|
r := recover()
|
|
|
|
if r == nil {
|
|
|
|
t.Error("expect panic, but nil")
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
MustToContext(context.Background(), &Instance{})
|
|
|
|
}
|