diff --git a/lib/net/imap/sequence_set.rb b/lib/net/imap/sequence_set.rb index 28a51fc9c..29c59e800 100644 --- a/lib/net/imap/sequence_set.rb +++ b/lib/net/imap/sequence_set.rb @@ -2434,11 +2434,9 @@ def slice_range(range) end if (first * last).positive? && last < first remain_frozen_empty - elsif (min = at(first)) - max = at(last) - max = :* if max.nil? - if max == :* then self & (min..) - elsif min <= max then self & (min..max) + elsif (min = sorted_set_num_at(first)) + max = sorted_set_num_at(last) || STAR_INT + if min <= max then intersection export_minmax_entry [min, max] else remain_frozen_empty end end diff --git a/test/net/imap/test_sequence_set.rb b/test/net/imap/test_sequence_set.rb index b4a10ea28..bd3801076 100644 --- a/test/net/imap/test_sequence_set.rb +++ b/test/net/imap/test_sequence_set.rb @@ -496,15 +496,6 @@ def pend_slice_lomax(set, start, actual) assert_equal set[start..], actual end - def pend_slice_star(expected, &) - pend_slice_bug "don't crash when min == :*" do - assert_same expected, yield - end - assert_raise_with_message(ArgumentError, - /\Acomparison of Symbol with \d+ /, - &) - end - def pend_slice_nil(actual) pend_slice_bug "return nil for invalid slice start index" do assert_nil actual @@ -616,7 +607,7 @@ def pend_slice_zero_len(&) assert_same SequenceSet.empty, set[-100.. 99] # i.e: 100.. 99 assert_same SequenceSet.empty, set[ -1... 199] # i.e: 199...199 assert_same SequenceSet.empty, set[ -1.. 198] # i.e: 199...198 - pend_slice_star SequenceSet.empty do SequenceSet.full[-1..0] end + assert_same SequenceSet.empty, SequenceSet.full[-1..0] assert_same SequenceSet.empty, SequenceSet.full[-1...0] end