func validateDynamicArg(argValue string, token *Token, lookup *gauge.ArgLookup) (*gauge.StepArg, *ParseDetailResult) { if !isConceptHeader(lookup) && !lookup.ContainsArg(argValue) { return nil, &ParseDetailResult{Error: &ParseError{LineNo: token.LineNo, Message: fmt.Sprintf("Dynamic parameter <%s> could not be resolved", argValue), LineText: token.LineText}} } stepArgument := &gauge.StepArg{ArgType: gauge.Dynamic, Value: argValue, Name: argValue} return stepArgument, nil }
func addInlineTableRow(step *gauge.Step, token *Token, argLookup *gauge.ArgLookup) ParseResult { dynamicArgMatcher := regexp.MustCompile("^<(.*)>$") tableValues := make([]gauge.TableCell, 0) warnings := make([]*Warning, 0) for _, tableValue := range token.Args { if dynamicArgMatcher.MatchString(tableValue) { match := dynamicArgMatcher.FindAllStringSubmatch(tableValue, -1) param := match[0][1] if !argLookup.ContainsArg(param) { tableValues = append(tableValues, gauge.TableCell{Value: tableValue, CellType: gauge.Static}) warnings = append(warnings, &Warning{LineNo: token.LineNo, Message: fmt.Sprintf("Dynamic param <%s> could not be resolved, Treating it as static param", param)}) } else { tableValues = append(tableValues, gauge.TableCell{Value: param, CellType: gauge.Dynamic}) } } else { tableValues = append(tableValues, gauge.TableCell{Value: tableValue, CellType: gauge.Static}) } } step.AddInlineTableRow(tableValues) return ParseResult{Ok: true, Warnings: warnings} }