(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestSetValue(t *testing.T) { |
| 30 | t.Parallel() |
| 31 | value := map[string]string{ |
| 32 | "foo": "bar", |
| 33 | } |
| 34 | key := "testValue" |
| 35 | session, _, cleanup := newTestSessionWithOptions(t, &Server{ |
| 36 | Handler: func(s Session) { |
| 37 | v := s.Context().Value(key).(map[string]string) |
| 38 | if v["foo"] != value["foo"] { |
| 39 | t.Fatalf("got %#v; want %#v", v, value) |
| 40 | } |
| 41 | }, |
| 42 | }, nil, PasswordAuth(func(ctx Context, password string) bool { |
| 43 | ctx.SetValue(key, value) |
| 44 | return true |
| 45 | })) |
| 46 | defer cleanup() |
| 47 | if err := session.Run(""); err != nil { |
| 48 | t.Fatal(err) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestSetValueConcurrency(t *testing.T) { |
| 53 | ctx, cancel := newContext(nil) |
nothing calls this directly
no test coverage detected
searching dependent graphs…