Skip to content

Commit

Permalink
Merge pull request #117 from fatkodima/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
SamSaffron authored Jun 17, 2024
2 parents cd6fa67 + 17ceef6 commit 846e6b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/test_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/test_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/test_reporter_public_start_stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_results.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 846e6b5

Please sign in to comment.