Skip to content

Commit

Permalink
🔎 Simplify parser test debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
nevans committed Nov 12, 2023
1 parent f5ef196 commit b7f4d66
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/net/imap/net_imap_test_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ def generate_tests_from(fixture_data: nil, fixture_file: nil)
when :parser_assert_equal
response = test.fetch(:response).force_encoding "ASCII-8BIT"
expected = test.fetch(:expected)
debug = test.fetch(:debug, false)

define_method name do
with_debug do
parser = Net::IMAP::ResponseParser.new
actual = parser.parse response
binding.irb if debug
assert_equal expected, actual
end
end
Expand All @@ -58,7 +60,9 @@ def generate_tests_from(fixture_data: nil, fixture_file: nil)
with_debug do
parser = Net::IMAP::ResponseParser.new
actual = parser.parse response
puts YAML.dump name => {response: response, expected: actual}
puts YAML.dump "tests" => {
name => {response: response, expected: actual}
}
pend "update tests with expected data..."
end
end
Expand Down

0 comments on commit b7f4d66

Please sign in to comment.