From 17ceef6f56ea5118808dc270e12a81a9033afefd Mon Sep 17 00:00:00 2001 From: fatkodima Date: Mon, 17 Jun 2024 03:03:01 +0300 Subject: [PATCH] Fix tests --- test/test_cli.rb | 4 ++-- test/test_reporter.rb | 8 ++++---- test/test_reporter_public_start_stop.rb | 2 +- test/test_results.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_cli.rb b/test/test_cli.rb index db0330f..c79bed6 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -81,7 +81,7 @@ def test_normalize_paths end assert_match(%r!\d+\s{2}longhorn-0.1.0/lib/longhorn.rb:\d+!, out) - assert_match(%r!ruby/lib/set.rb!, out) + assert_match(%r!ruby/lib/\S*set.rb!, out) end def test_pretty @@ -91,7 +91,7 @@ def test_pretty assert_match(/\d kB/, out) assert_match(%r!\d+\s{2}longhorn-0.1.0/lib/longhorn.rb:\d+!, out) - assert_match(%r!ruby/lib/set.rb!, out) + assert_match(%r!ruby/lib/\S*set.rb!, out) end def test_prints_help_when_script_not_specified diff --git a/test/test_reporter.rb b/test/test_reporter.rb index e33c24a..127d4af 100644 --- a/test/test_reporter.rb +++ b/test/test_reporter.rb @@ -12,7 +12,7 @@ def setup def default_block # Create an object from a gem outside memory_profiler which allocates # its own objects internally - MiniTest::Reporter.new + Minitest::Reporter.new # Create 10 strings 10.times { |i| i.to_s } @@ -77,7 +77,7 @@ def test_string_reporting_class def test_counts results = create_report - assert_equal(16, results.total_allocated) + assert_equal(15, results.total_allocated) assert_equal(1, results.total_retained) assert_equal(1, results.retained_objects_by_location.length) end @@ -96,13 +96,13 @@ def test_class_tracing_with_value def test_ignore_file_with_regex results = create_report(ignore_files: /test_reporter\.rb/) - assert_equal(3, results.total_allocated) + assert_equal(2, results.total_allocated) assert_equal(0, results.total_retained) end def test_ignore_file_with_string results = create_report(ignore_files: 'test_reporter.rb|another_file.rb') - assert_equal(3, results.total_allocated) + assert_equal(2, results.total_allocated) assert_equal(0, results.total_retained) end diff --git a/test/test_reporter_public_start_stop.rb b/test/test_reporter_public_start_stop.rb index 2e774ea..f23692c 100644 --- a/test/test_reporter_public_start_stop.rb +++ b/test/test_reporter_public_start_stop.rb @@ -37,7 +37,7 @@ def test_module_double_start assert_equal(reporter, same_reporter) # Some extra here due to variables needed in the test above - assert_equal(17, results.total_allocated) + assert_equal(16, results.total_allocated) end def test_exception_handling diff --git a/test/test_results.rb b/test/test_results.rb index 2aa03ef..97cb4ef 100644 --- a/test/test_results.rb +++ b/test/test_results.rb @@ -80,6 +80,6 @@ def test_normalize_paths_true io = StringIO.new report.pretty_print(io, normalize_paths: true) assert_match(%r!\d+\s{2}longhorn-0.1.0/lib/longhorn.rb:\d+!, io.string) - assert_match(%r!ruby/lib/set.rb!, io.string) + assert_match(%r!ruby/lib/\S*set.rb!, io.string) end end