Skip to content

Test Range#sole with an endless range - #57548

Merged
fatkodima merged 1 commit into
rails:mainfrom
hammadxcm:test-range-sole-endless
Jun 3, 2026
Merged

fatkodima merged 1 commit into
rails:mainfrom
hammadxcm:test-range-sole-endless

Conversation

@hammadxcm

Copy link
Copy Markdown
Contributor

Range#sole raises SoleItemExpectedError for an infinite range, where either end is nil. The beginless case ((..1).sole) was tested, but the endless case ((1..).sole) — the other half of the self.begin.nil? || self.end.nil? guard — was not.

This adds coverage for the endless range. No production code changes — test-only.

Range#sole raises for an infinite range, where either end is nil.
The beginless case (..1) was tested but the endless case (1..) was
not.

Add coverage for the endless range.
@fatkodima
fatkodima merged commit d079d5e into rails:main Jun 3, 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