Skip to content

Commit adba39f

Browse files
committed
♻️ Move LIST/XLIST response parser tests to yaml
drop test_flag_list_many_same_flags... not really an issue any more
1 parent 0c1298b commit adba39f

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
:tests:
3+
4+
test_list_with_various_flag_types_and_capitalizations:
5+
:response: "* LIST (\\foo bAR $Etc \\baz) \".\" \"INBOX\"\r\n"
6+
:expected: !ruby/struct:Net::IMAP::UntaggedResponse
7+
name: LIST
8+
data: !ruby/struct:Net::IMAP::MailboxList
9+
attr:
10+
- :Foo
11+
- bAR
12+
- $Etc
13+
- :Baz
14+
delim: "."
15+
name: INBOX
16+
raw_data: "* LIST (\\foo bAR $Etc \\baz) \".\" \"INBOX\"\r\n"
17+
18+
test_xlist_inbox:
19+
:response: "* XLIST (\\Inbox) \".\" \"INBOX\"\r\n"
20+
:expected: !ruby/struct:Net::IMAP::UntaggedResponse
21+
name: XLIST
22+
data: !ruby/struct:Net::IMAP::MailboxList
23+
attr:
24+
- :Inbox
25+
delim: "."
26+
name: INBOX
27+
raw_data: "* XLIST (\\Inbox) \".\" \"INBOX\"\r\n"

test/net/imap/test_imap_response_parser.rb

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def teardown
3333
# §7.2.2: CAPABILITY response
3434
generate_tests_from fixture_file: "capability_responses.yml"
3535

36+
# §7.3.1: LIST response (including obsolete LSUB and XLIST responses)
37+
generate_tests_from fixture_file: "list_responses.yml"
38+
3639
# §7.3.2: NAMESPACE response (also RFC2342)
3740
generate_tests_from fixture_file: "namespace_responses.yml"
3841

@@ -65,25 +68,6 @@ def teardown
6568
# response data, should still use normal tests, below
6669
############################################################################
6770

68-
def test_flag_list_many_same_flags
69-
parser = Net::IMAP::ResponseParser.new
70-
assert_nothing_raised do
71-
100.times do
72-
parser.parse(<<EOF.gsub(/\n/, "\r\n"))
73-
* LIST (\\Foo) "." "INBOX"
74-
EOF
75-
end
76-
end
77-
end
78-
79-
def test_flag_xlist_inbox
80-
parser = Net::IMAP::ResponseParser.new
81-
response = parser.parse(<<EOF.gsub(/\n/, "\r\n"))
82-
* XLIST (\\Inbox) "." "INBOX"
83-
EOF
84-
assert_equal [:Inbox], response.data.attr
85-
end
86-
8771
def test_enable
8872
parser = Net::IMAP::ResponseParser.new
8973
response = parser.parse("* ENABLED SMTPUTF8\r\n")

0 commit comments

Comments
 (0)