From 0af3baa3a61bb4ec9fcba3316b5db6ea5cd653c2 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Wed, 19 Mar 2025 14:33:17 -0400 Subject: [PATCH] Ensure parity in tests for reporters --- test/fixtures/test_unit_example.rb | 6 ++++++ test/test_unit_test_runner_test.rb | 33 ++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/test/fixtures/test_unit_example.rb b/test/fixtures/test_unit_example.rb index a9b1768077..1e3ff31691 100644 --- a/test/fixtures/test_unit_example.rb +++ b/test/fixtures/test_unit_example.rb @@ -21,4 +21,10 @@ def test_that_is_pending def test_that_raises raise "oops" end + + def test_with_output + $stdout.puts "hello from $stdout.puts\nanother line" + puts "hello from puts\nanother line" + $stdout.write "hello from write\nanother line" + end end diff --git a/test/test_unit_test_runner_test.rb b/test/test_unit_test_runner_test.rb index c7d61c60c9..c855a9de40 100644 --- a/test/test_unit_test_runner_test.rb +++ b/test/test_unit_test_runner_test.rb @@ -80,7 +80,40 @@ def test_test_runner_output "uri" => uri, }, }, + { + "method" => "start", + "params" => { + "id" => "SampleTest#test_with_output", + "uri" => uri, + }, + }, + { + "method" => "append_output", + "params" => { + "message" => "hello from $stdout.puts\r\nanother line\r\n", + }, + }, + { + "method" => "append_output", + "params" => { + "message" => "hello from puts\r\nanother line\r\n", + }, + }, + { + "method" => "append_output", + "params" => { + "message" => "hello from write\r\nanother line", + }, + }, + { + "method" => "pass", + "params" => { + "id" => "SampleTest#test_with_output", + "uri" => uri, + }, + }, ] + assert_equal(2 + 2 + 2 + 2 + 5, actual.size) assert_equal(expected, actual) end end