Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/net/imap/sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 1 addition & 10 deletions test/net/imap/test_sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading