diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 05511dd3..f1af1863 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -1945,6 +1945,7 @@ def uid_expunge(uid_set) # * When +criteria+ is an array, each member is a +SEARCH+ command argument: # * Any SequenceSet sends SequenceSet#valid_string. # These types are converted to SequenceSet for validation and encoding: + # * +Set+ # * +Range+ # * -1 translates to * # * nested +Array+ @@ -3204,7 +3205,7 @@ def normalize_searching_criteria(criteria) def coerce_search_arg_to_seqset?(obj) case obj - when -1 then true + when Set, -1 then true when Range then true when Array then true else false diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index bb498e6b..01c1d5a7 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -1224,6 +1224,9 @@ def test_unselect imap.search(["SUBJECT", "1,*"]) assert_equal 'SUBJECT "1,*"', server.commands.pop.args + imap.search(["subject", "hello", Set[1, 2, 3, 4, 5, 8, *(10..100)]]) + assert_equal "subject hello 1:5,8,10:100", server.commands.pop.args + server.on "UID SEARCH", &search_resp assert_equal search_result, imap.uid_search(["subject", "hello", [1..22, 30..-1]])