| 112 | } |
| 113 | |
| 114 | func contextReaderTests(ctx expr.ContextReader) func(t *testing.T) { |
| 115 | return func(t *testing.T) { |
| 116 | keyok := func(key string) { |
| 117 | v, ok := ctx.Get(key) |
| 118 | assert.Equal(t, true, ok, "expected ok for %v %#v", key, ctx) |
| 119 | assert.NotEqual(t, nil, v) |
| 120 | } |
| 121 | if msg, ok := ctx.(schema.Message); ok { |
| 122 | assert.Equal(t, uint64(0), msg.Id()) |
| 123 | assert.NotEqual(t, nil, msg.Body()) |
| 124 | } |
| 125 | if msg, ok := ctx.(schema.TimeMessage); ok { |
| 126 | assert.NotEqual(t, 0, msg.Ts().Unix()) |
| 127 | } |
| 128 | for _, key := range cols { |
| 129 | keyok(key) |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | func messageInterfaceTests(msg schema.Message) func(t *testing.T) { |
| 134 | return func(t *testing.T) { |
| 135 | if msg2, ok := msg.(schema.Message); ok { |