Skip to content

Commit 3502886

Browse files
committed
♻️ Move strange parser workaround tests to yaml
1 parent 6e887af commit 3502886

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
:tests:
3+
test_invalid_noop_response_is_ignored:
4+
:comment: |
5+
This should probably use UntaggedResponse, perhaps with an
6+
UnparsedResponseData object for its #data.
7+
:response: "* NOOP\r\n"
8+
:expected: !ruby/struct:Net::IMAP::IgnoredResponse
9+
raw_data: "* NOOP\r\n"

test/net/imap/test_imap_response_parser.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def teardown
6969
# RFC 5256: THREAD response
7070
generate_tests_from fixture_file: "thread_responses.yml"
7171

72+
############################################################################
73+
# Workarounds or unspecified extensions:
74+
generate_tests_from fixture_file: "quirky_behaviors.yml"
75+
7276
############################################################################
7377
# More interesting tests about the behavior, either of the test or of the
7478
# response data, should still use normal tests, below
@@ -82,15 +86,8 @@ def test_enable
8286
assert_equal("SMTPUTF8", response.data.first)
8387
end
8488

85-
def test_ignored_response
86-
parser = Net::IMAP::ResponseParser.new
87-
response = nil
88-
assert_nothing_raised do
89-
response = parser.parse("* NOOP\r\n")
90-
end
91-
assert_instance_of(Net::IMAP::IgnoredResponse, response)
92-
end
93-
89+
# todo: move this to response data tests file
90+
# it's testing the mapping fn, not the parsing.
9491
def test_uidplus_copyuid__uid_mapping
9592
parser = Net::IMAP::ResponseParser.new
9693
response = parser.parse(

0 commit comments

Comments
 (0)