本文整理匯總了Golang中github.com/getgauge/gauge/gauge_messages.Parameter類的典型用法代碼示例。如果您正苦於以下問題:Golang Parameter類的具體用法?Golang Parameter怎麽用?Golang Parameter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Parameter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: makeParameterCopy
func makeParameterCopy(parameter *gauge_messages.Parameter) *gauge_messages.Parameter {
switch parameter.GetParameterType() {
case gauge_messages.Parameter_Static:
return &gauge_messages.Parameter{ParameterType: gauge_messages.Parameter_Static.Enum(), Value: proto.String(parameter.GetValue()), Name: proto.String(parameter.GetName())}
case gauge_messages.Parameter_Dynamic:
return &gauge_messages.Parameter{ParameterType: gauge_messages.Parameter_Dynamic.Enum(), Value: proto.String(parameter.GetValue()), Name: proto.String(parameter.GetName())}
case gauge_messages.Parameter_Table:
return &gauge_messages.Parameter{ParameterType: gauge_messages.Parameter_Table.Enum(), Table: makeTableCopy(parameter.GetTable()), Name: proto.String(parameter.GetName())}
case gauge_messages.Parameter_Special_String:
return &gauge_messages.Parameter{ParameterType: gauge_messages.Parameter_Special_String.Enum(), Value: proto.String(parameter.GetValue()), Name: proto.String(parameter.GetName())}
case gauge_messages.Parameter_Special_Table:
return &gauge_messages.Parameter{ParameterType: gauge_messages.Parameter_Special_Table.Enum(), Table: makeTableCopy(parameter.GetTable()), Name: proto.String(parameter.GetName())}
}
return parameter
}
示例2: compareParameter
func compareParameter(parameter1 *gauge_messages.Parameter, parameter2 *gauge_messages.Parameter, c *C) {
if parameter1 != nil && parameter2 != nil {
c.Assert(parameter1.GetParameterType(), Equals, parameter2.GetParameterType())
c.Assert(parameter1.GetName(), Equals, parameter2.GetName())
c.Assert(parameter1.GetValue(), Equals, parameter2.GetValue())
compareTable(parameter1.GetTable(), parameter2.GetTable(), c)
} else if (parameter1 == nil && parameter2 != nil) || (parameter1 != nil && parameter2 == nil) {
c.Log("One parameter was nil and the other wasn't")
c.Fail()
}
}
示例3: getResolvedParams
func (paramResolver *paramResolver) getResolvedParams(step *step, parent *step, dataTableLookup *argLookup) []*gauge_messages.Parameter {
parameters := make([]*gauge_messages.Parameter, 0)
for _, arg := range step.args {
parameter := new(gauge_messages.Parameter)
parameter.Name = proto.String(arg.name)
if arg.argType == static {
parameter.ParameterType = gauge_messages.Parameter_Static.Enum()
parameter.Value = proto.String(arg.value)
} else if arg.argType == dynamic {
var resolvedArg *stepArg
if parent != nil {
resolvedArg = parent.getArg(arg.value)
} else {
resolvedArg = dataTableLookup.getArg(arg.value)
}
//In case a special table used in a concept, you will get a dynamic table value which has to be resolved from the concept lookup
parameter.Name = proto.String(resolvedArg.name)
if resolvedArg.table.isInitialized() {
parameter.ParameterType = gauge_messages.Parameter_Special_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&resolvedArg.table, dataTableLookup)
} else {
parameter.ParameterType = gauge_messages.Parameter_Dynamic.Enum()
parameter.Value = proto.String(resolvedArg.value)
}
} else if arg.argType == specialString {
parameter.ParameterType = gauge_messages.Parameter_Special_String.Enum()
parameter.Value = proto.String(arg.value)
} else if arg.argType == specialTable {
parameter.ParameterType = gauge_messages.Parameter_Special_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&arg.table, dataTableLookup)
} else {
parameter.ParameterType = gauge_messages.Parameter_Table.Enum()
parameter.Table = paramResolver.createProtoStepTable(&arg.table, dataTableLookup)
}
parameters = append(parameters, parameter)
}
return parameters
}