2018-12-07 10:13:53 +01:00
|
|
|
package debug
|
2018-12-06 15:18:05 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestContextDebug(t *testing.T) {
|
|
|
|
|
|
|
|
debug := false
|
|
|
|
ctx := context.WithValue(context.Background(), KeyDebug, debug)
|
|
|
|
|
2018-12-07 10:13:53 +01:00
|
|
|
dbg, err := From(ctx)
|
2018-12-06 15:18:05 +01:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if dbg {
|
|
|
|
t.Fatal("debug should be false")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|