Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #117

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading