goweb/middleware/debug_test.go

23 lines
289 B
Go

package middleware
import (
"context"
"testing"
)
func TestContextDebug(t *testing.T) {
debug := false
ctx := context.WithValue(context.Background(), KeyDebug, debug)
dbg, err := GetDebug(ctx)
if err != nil {
t.Fatal(err)
}
if dbg {
t.Fatal("debug should be false")
}
}