示例#1
0
func checkval(t *testing.T, r expr.ContextReader, key string, expected value.Value) {
	val, ok := r.Get(key)
	assert.Tf(t, ok, "expected key:%s =%v", key, expected.Value())
	if val == nil {
		t.Errorf("not value for %v", key)
	} else {
		assert.Equalf(t, expected.Value(), val.Value(), "%s expected: %v  got:%v", key, expected.Value(), val.Value())
	}
}
示例#2
0
func NewSqlDriverMessageMapCtx(id uint64, ctx expr.ContextReader, colindex map[string]int) *SqlDriverMessageMap {
	row := make([]driver.Value, len(colindex))
	for key, idx := range colindex {
		val, ok := ctx.Get(key)
		if ok {
			row[idx] = val.Value()
		}
	}
	return &SqlDriverMessageMap{IdVal: id, ColIndex: colindex, Vals: row}
}
示例#3
0
func checkval(t *testing.T, r expr.ContextReader, key string, expected value.Value) {
	val, ok := r.Get(key)
	assert.T(t, ok)
	assert.Equalf(t, expected, val, "%s expected: %v  got:%v", key, expected, val)
}