From b7f4d66e54d32984c5229b577576701e45e5f412 Mon Sep 17 00:00:00 2001 From: nicholas evans Date: Sun, 12 Nov 2023 07:44:37 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8E=20Simplify=20parser=20test=20debug?= =?UTF-8?q?ging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/net_imap_test_helpers.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/net/imap/net_imap_test_helpers.rb b/test/net/imap/net_imap_test_helpers.rb index f848f35b..7ef749ae 100644 --- a/test/net/imap/net_imap_test_helpers.rb +++ b/test/net/imap/net_imap_test_helpers.rb @@ -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 @@ -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