Accept ConfigKit integers in module options
This commit is contained in:
@@ -121,9 +121,19 @@ func TestPlanRejectsInvalidOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeOptionsRejectsNonNativeIntegers(t *testing.T) {
|
||||
func TestDecodeOptionsAcceptsConfigKitIntegers(t *testing.T) {
|
||||
options, err := DecodeOptions(map[string]any{"max_units": int64(2), "overlap_units": int64(1)})
|
||||
if err != nil {
|
||||
t.Fatalf("DecodeOptions() error = %v", err)
|
||||
}
|
||||
if options.MaxUnits != 2 || options.OverlapUnits != 1 {
|
||||
t.Fatalf("DecodeOptions() = %#v", options)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecodeOptionsRejectsUnsupportedIntegerRepresentations(t *testing.T) {
|
||||
for _, value := range []any{
|
||||
int8(2), int16(2), int32(2), int64(2),
|
||||
int8(2), int16(2), int32(2),
|
||||
uint(2), uint8(2), uint16(2), uint32(2), uint64(2),
|
||||
float32(2), float64(2), json.Number("2"),
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user