Last active
June 6, 2024 16:13
-
-
Save olly/04d8b5be104747aa89b954a718b15d76 to your computer and use it in GitHub Desktop.
Timecop Indefinite Wait with `Concurrent::IVar`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
ruby '3.3.0' | |
gem 'concurrent-ruby', '1.3.1' | |
gem 'minitest', '5.23.1' | |
gem 'timecop', '0.9.9' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GEM | |
remote: https://rubygems.org/ | |
specs: | |
concurrent-ruby (1.3.1) | |
minitest (5.23.1) | |
timecop (0.9.9) | |
PLATFORMS | |
aarch64-linux | |
arm-linux | |
arm64-darwin | |
x86-linux | |
x86_64-darwin | |
x86_64-linux | |
DEPENDENCIES | |
concurrent-ruby (= 1.3.1) | |
minitest (= 5.23.1) | |
timecop (= 0.9.9) | |
RUBY VERSION | |
ruby 3.3.0p0 | |
BUNDLED WITH | |
2.5.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundler.setup | |
require 'concurrent-ruby' | |
require 'timecop' | |
require 'minitest/autorun' | |
class HangTest < Minitest::Test | |
def test_hang | |
Timecop.freeze(2024, 6, 1) do | |
ivar = Concurrent::IVar.new | |
ivar.value!(0.01) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle install | |
bundle exec ruby hang_test.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment