1package access23import (4 "context"5 "testing"6)78func TestGoodFromContext(t *testing.T) {9 ctx := WithContext(context.TODO(), AdminAccess)10 if ac := FromContext(ctx); ac != AdminAccess {11 t.Errorf("FromContext(ctx) => %d, want %d", ac, AdminAccess)12 }13}1415func TestBadFromContext(t *testing.T) {16 ctx := context.TODO()17 if ac := FromContext(ctx); ac != -1 {18 t.Errorf("FromContext(ctx) => %d, want %d", ac, -1)19 }20}