-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Improve UIDPlusData#uid_mapping test coverage
Explicitly test how unsorted uid-sets are handled.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
require "net/imap" | ||
require "test/unit" | ||
|
||
class TestUIDPlusData < Test::Unit::TestCase | ||
|
||
test "#uid_mapping with sorted source_uids" do | ||
uidplus = Net::IMAP::UIDPlusData.new( | ||
1, [19, 20, *(495..500)], [*(92..97), 100, 101], | ||
) | ||
assert_equal( | ||
{ | ||
19 => 92, | ||
20 => 93, | ||
495 => 94, | ||
496 => 95, | ||
497 => 96, | ||
498 => 97, | ||
499 => 100, | ||
500 => 101, | ||
}, | ||
uidplus.uid_mapping | ||
) | ||
end | ||
|
||
test "#uid_mapping for with source_uids in unsorted order" do | ||
uidplus = Net::IMAP::UIDPlusData.new( | ||
1, [*(495..500), 19, 20], [*(92..97), 100, 101], | ||
) | ||
assert_equal( | ||
{ | ||
495 => 92, | ||
496 => 93, | ||
497 => 94, | ||
498 => 95, | ||
499 => 96, | ||
500 => 97, | ||
19 => 100, | ||
20 => 101, | ||
}, | ||
uidplus.uid_mapping | ||
) | ||
end | ||
|
||
end |