Skip to content

Commit 5b1da5b

Browse files
committed
✅ Improve test coverage for search arg coercion
This adds tests for * String => quoted string * Range => sequence-set * -1 => sequence-set * sequence-set string with "*" => quoted string
1 parent 8615c61 commit 5b1da5b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/net/imap/test_imap.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,10 +1206,23 @@ def test_unselect
12061206
end
12071207

12081208
server.on "SEARCH", &search_resp
1209-
assert_equal search_result, imap.search(["subject", "hello",
1209+
assert_equal search_result, imap.search(["subject", "hello world",
12101210
[1..5, 8, 10..-1]])
12111211
cmd = server.commands.pop
1212-
assert_equal ["SEARCH", "subject hello 1:5,8,10:*"], [cmd.name, cmd.args]
1212+
assert_equal(
1213+
["SEARCH",'subject "hello world" 1:5,8,10:*'],
1214+
[cmd.name, cmd.args]
1215+
)
1216+
1217+
imap.search(["OR", 1..1000, -1, "UID", 12345..-1])
1218+
assert_equal "OR 1:1000 * UID 12345:*", server.commands.pop.args
1219+
1220+
imap.search([1..1000, "UID", 12345..])
1221+
assert_equal "1:1000 UID 12345:*", server.commands.pop.args
1222+
1223+
# Unfortunately, we can't send every sequence-set string directly
1224+
imap.search(["SUBJECT", "1,*"])
1225+
assert_equal 'SUBJECT "1,*"', server.commands.pop.args
12131226

12141227
server.on "UID SEARCH", &search_resp
12151228
assert_equal search_result, imap.uid_search(["subject", "hello",

0 commit comments

Comments
 (0)