Skip to content

Fix Date#setDay validation for all 30-day months#492

Open
cuiweixie wants to merge 1 commit intoIoLanguage:masterfrom
cuiweixie:fix/date-setday-thirty-day-months
Open

Fix Date#setDay validation for all 30-day months#492
cuiweixie wants to merge 1 commit intoIoLanguage:masterfrom
cuiweixie:fix/date-setday-thirty-day-months

Conversation

@cuiweixie
Copy link
Copy Markdown

Summary

IoDate_setDay only applied the 30-day guard to November (month == 11), so April, June, and September were not validated as 30-day months and could accept setDay(31) incorrectly.

Changes

  • Extend the same 1–30 day assertion to months 4, 6, 9, and 11 (calendar 30-day months).
  • Add DateTest regression: assertRaisesException for setDay(31) in each of those months, plus isLaunchScript so io DateTest.io runs the suite.

Testing

cd build && cmake --build .
./_build/binaries/io ../libs/iovm/tests/correctness/DateTest.io

IoDate_setDay only applied the 30-day guard to November (11), so April, June, and September accepted day 31 against the calendar. Apply the same bounds check to months 4, 6, 9, and 11.

Add DateTest regression coverage and isLaunchScript runner for direct io DateTest.io runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant