Skip to content

Accept string arguments in SequenceSet delete? - #741

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/deletion-imap
Open

Accept string arguments in SequenceSet delete?#741
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/deletion-imap

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Use String#match? when deciding whether a delete? argument represents one number or a range. String#include? does not accept a Regexp, so documented string inputs currently raise TypeError. Retain the numeric-versus-SequenceSet return distinction introduced by #583.

Reproduction

require 'net/imap'
set = Net::IMAP::SequenceSet.new('1:5')
p set.delete?('2') # 2
p set.delete?('3:4').to_s # "3:4"
p set.to_s # "1,5"
# Before: TypeError on the first deletion.

Verification

  • 39 focused checks; 28 failing expectations before, zero afterward. Empty/nonempty sets, present/absent numbers, reversed/equal ranges, star and frozen rejection are covered. The source of merged 🐛 Fix SequenceSet#delete?(num..num) to return set #583 and its earlier numeric/range return policy was reviewed.
  • Existing rake test on this isolated branch: 1726 tests, 12604 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications, Ruby 4.0.6 via rbenv. The baseline also passes all 1,726 tests; assertion counts vary slightly across runs.
  • Supplemental RuboCop Lint retains the same 48 existing findings. Ruby syntax and git diff --check pass. No repository tests, dependencies or workflows were added or modified; focused reproductions live outside the repository under the consumer's no-new-tests policy.
  • Independent branch based on 6d2ef7a636a1e2449187a83b06ac7a5baa54ead2; the runtime diff from released 0.6.6 is documentation-only before this patch.

Compatibility and limits

No public signature change. String numbers now return a number and string ranges return a SequenceSet, as intended. Missing entries still return nil and frozen sets still raise FrozenError. Other Ruby/OS versions were not run locally. No production or external IMAP service was used. Local verification does not imply upstream CI approval or comprehensive behavioral coverage.

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