Simplify module cleanup paths

This commit is contained in:
2026-08-09 02:40:25 +00:00
parent d28d1062e0
commit 0546f6eb4f
5 changed files with 21 additions and 101 deletions

View File

@@ -121,6 +121,22 @@ func TestPlanRejectsInvalidOptions(t *testing.T) {
}
}
func TestDecodeOptionsRejectsNonNativeIntegers(t *testing.T) {
for _, value := range []any{
int8(2), int16(2), int32(2), int64(2),
uint(2), uint8(2), uint16(2), uint32(2), uint64(2),
float32(2), float64(2), json.Number("2"),
} {
_, err := DecodeOptions(map[string]any{"max_units": value})
if err == nil {
t.Fatalf("DecodeOptions(max_units: %T) error = nil, want error", value)
}
if !strings.Contains(err.Error(), "max_units must be an integer") {
t.Fatalf("DecodeOptions(max_units: %T) error = %q, want integer type error", value, err)
}
}
}
func TestPlanRejectsEmptySource(t *testing.T) {
doc := testSource(1)
doc.Units = nil