Skip to content

Test Array offset accessors when out of bounds - #57540

Merged
rafaelfranca merged 1 commit into
rails:mainfrom
hammadxcm:test-array-out-of-bounds-accessors
Jun 2, 2026
Merged

rafaelfranca merged 1 commit into
rails:mainfrom
hammadxcm:test-array-out-of-bounds-accessors

Conversation

@hammadxcm

Copy link
Copy Markdown
Contributor

Array#second through #forty_two and #second_to_last/#third_to_last return nil when the array is shorter than the requested position, but the only existing test (test_specific_accessor) used a 42-element array, so every accessor returned a real element and the nil path was never exercised.

This adds coverage for the out-of-bounds (nil) path. No production code changes — test-only.

Array#second through #forty_two and #second_to_last/#third_to_last
return nil when the array is too short, but the only test used a
42-element array so every accessor returned a real element.

Add coverage for the out-of-bounds (nil) path.
@rafaelfranca
rafaelfranca merged commit ba6f33c into rails:main Jun 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants