MCPcopy Create free account
hub / github.com/araddon/qlbridge / contextReaderTests

Function contextReaderTests

datasource/context_test.go:114–132  ·  view source on GitHub ↗
(ctx expr.ContextReader)

Source from the content-addressed store, hash-verified

112}
113
114func 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}
133func messageInterfaceTests(msg schema.Message) func(t *testing.T) {
134 return func(t *testing.T) {
135 if msg2, ok := msg.(schema.Message); ok {

Callers 1

TestContextFunction · 0.85

Calls 5

GetMethod · 0.65
EqualMethod · 0.65
IdMethod · 0.65
BodyMethod · 0.65
TsMethod · 0.65

Tested by

no test coverage detected