Xray-core/core/context_test.go
yuhan6665 496b2c02c5
Fix context api and document (#727)
* Fix Dial function crash instance when there is no instance context in the ctx

* check ctx to fix. (#841)

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

* remove exported API: toContext

* Remove unnecessary API

* rework document for API

* fix: make sure the ctx is propagated to connections by detached connection

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
Co-authored-by: rurirei <72071920+rurirei@users.noreply.github.com>
2022-02-19 22:45:41 -05:00

21 lines
280 B
Go

package core_test
import (
"context"
"testing"
. "github.com/xtls/xray-core/core"
_ "unsafe"
)
func TestFromContextPanic(t *testing.T) {
defer func() {
r := recover()
if r == nil {
t.Error("expect panic, but nil")
}
}()
MustFromContext(context.Background())
}