You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert.Equal(t, `cannot convert argument 0: "11111111111111111111111111111111" to int64: strconv.ParseInt: parsing "11111111111111111111111111111111": value out of range`, err.(error).Error())
326
326
}
327
327
328
+
funcTestShouldSupportUintTypes(t*testing.T) {
329
+
varaActualuint64
330
+
varbActualuint32
331
+
varcActualuint16
332
+
vardActualuint8
333
+
334
+
fn:=func(auint64, buint32, cuint16, duint8) {
335
+
aActual=a
336
+
bActual=b
337
+
cActual=c
338
+
dActual=d
339
+
}
340
+
341
+
def:=&models.StepDefinition{
342
+
StepDefinition: formatters.StepDefinition{
343
+
Handler: fn,
344
+
},
345
+
HandlerValue: reflect.ValueOf(fn),
346
+
}
347
+
348
+
def.Args= []interface{}{"1", "2", "3", "4"}
349
+
_, err:=def.Run(context.Background())
350
+
assert.Nil(t, err)
351
+
assert.Equal(t, uint64(1), aActual)
352
+
assert.Equal(t, uint32(2), bActual)
353
+
assert.Equal(t, uint16(3), cActual)
354
+
assert.Equal(t, uint8(4), dActual)
355
+
356
+
// 256 doesn't fit in uint8
357
+
def.Args= []interface{}{"1", "2", "3", "256"}
358
+
_, err=def.Run(context.Background())
359
+
assert.Equal(t, `cannot convert argument 3: "256" to uint8: strconv.ParseUint: parsing "256": value out of range`, err.(error).Error())
360
+
361
+
// 65536 doesn't fit in uint16
362
+
def.Args= []interface{}{"1", "2", "65536", "4"}
363
+
_, err=def.Run(context.Background())
364
+
assert.Equal(t, `cannot convert argument 2: "65536" to uint16: strconv.ParseUint: parsing "65536": value out of range`, err.(error).Error())
assert.Equal(t, `cannot convert argument 0: "18446744073709551616" to uint64: strconv.ParseUint: parsing "18446744073709551616": value out of range`, err.(error).Error())
0 commit comments