Skip to content

Commit

Permalink
Run merge_test.rb on Ruby 3.1 and higher
Browse files Browse the repository at this point in the history
  • Loading branch information
cfis committed Apr 17, 2023
1 parent 3615365 commit 192c181
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/merge_test.rb
Expand Up @@ -2,11 +2,12 @@
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)
require_relative './scheduler'

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')

require_relative './scheduler'

# -- Tests ----
# -- Tests ----
class MergeTest < TestCase
def worker1
sleep(0.5)
Expand Down Expand Up @@ -47,7 +48,7 @@ def concurrency_multiple_workers
end

def test_single_worker_unmerged
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME, :allow_exceptions => true) { concurrency_single_worker }
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) { concurrency_single_worker }
assert_equal(4, result.threads.size)

thread = result.threads[0]
Expand Down Expand Up @@ -76,7 +77,7 @@ def test_single_worker_unmerged
end

def test_single_worker_merged
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME, :allow_exceptions => true) { concurrency_single_worker }
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) { concurrency_single_worker }
result.merge!

assert_equal(2, result.threads.size)
Expand All @@ -95,7 +96,7 @@ def test_single_worker_merged
end

def test_multiple_workers_unmerged
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME, :allow_exceptions => true) { concurrency_multiple_workers }
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) { concurrency_multiple_workers }
assert_equal(4, result.threads.count)

thread = result.threads[0]
Expand Down Expand Up @@ -124,7 +125,7 @@ def test_multiple_workers_unmerged
end

def test_multiple_workers_merged
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME, :allow_exceptions => true) { concurrency_multiple_workers }
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) { concurrency_multiple_workers }
result.merge!

assert_equal(2, result.threads.count)
Expand Down

0 comments on commit 192c181

Please sign in to comment.