Ejemplo n.º 1
0
func (resolver *paramResolver) createProtoStepTable(table *table, dataTableLookup *argLookup) *gauge_messages.ProtoTable {
	protoTable := new(gauge_messages.ProtoTable)
	protoTable.Headers = &gauge_messages.ProtoTableRow{Cells: table.headers}
	tableRows := make([]*gauge_messages.ProtoTableRow, 0)
	for i := 0; i < len(table.columns[0]); i++ {
		row := make([]string, 0)
		for _, header := range table.headers {
			tableCell := table.get(header)[i]
			value := tableCell.value
			if tableCell.cellType == dynamic {
				//if concept has a table with dynamic cell, fetch from datatable
				value = dataTableLookup.getArg(tableCell.value).value
			}
			row = append(row, value)
		}
		tableRows = append(tableRows, &gauge_messages.ProtoTableRow{Cells: row})
	}
	protoTable.Rows = tableRows
	return protoTable
}