Skip to content

Commit

Permalink
Fix to use assert_crash_report results
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Feb 28, 2024
1 parent 05387b5 commit 8316cb2
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions test/ruby/test_rubyoptions.rb
Expand Up @@ -917,28 +917,24 @@ def assert_crash_report(path, cmd = nil)
end

def test_crash_report
assert_crash_report("%e.%f.%p.log") do |status, report|
assert_equal("#{File.basename(EnvUtil.rubybin)}.-e.#{status.pid}.log", report)
end
status, report = assert_crash_report("%e.%f.%p.log")
assert_equal("#{File.basename(EnvUtil.rubybin)}.-e.#{status.pid}.log", report)
end

def test_crash_report_script
assert_crash_report("%e.%f.%p.log", "bug.rb") do |status, report|
assert_equal("#{File.basename(EnvUtil.rubybin)}.bug.rb.#{status.pid}.log", report)
end
status, report = assert_crash_report("%e.%f.%p.log", "bug.rb")
assert_equal("#{File.basename(EnvUtil.rubybin)}.bug.rb.#{status.pid}.log", report)
end

def test_crash_report_executable_path
omit if EnvUtil.rubybin.size > 245
assert_crash_report("%E.%p.log") do |status, report|
assert_equal("#{EnvUtil.rubybin.tr('/', '!')}.#{status.pid}.log", report)
end
status, report = assert_crash_report("%E.%p.log")
assert_equal("#{EnvUtil.rubybin.tr('/', '!')}.#{status.pid}.log", report)
end

def test_crash_report_script_path
assert_crash_report("%F.%p.log", "test/bug.rb") do |status, report|
assert_equal("test!bug.rb.#{status.pid}.log", report)
end
status, report = assert_crash_report("%F.%p.log", "test/bug.rb")
assert_equal("test!bug.rb.#{status.pid}.log", report)
end

def test_crash_report_pipe
Expand Down

1 comment on commit 8316cb2

@matz
Copy link
Contributor

@matz matz commented on 8316cb2 Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fix assert_crash_report to accept blocks, instead?

Please sign in to comment.