Skip to content

Instantly share code, notes, and snippets.

@olly
Last active June 6, 2024 16:13
Show Gist options
  • Save olly/04d8b5be104747aa89b954a718b15d76 to your computer and use it in GitHub Desktop.
Save olly/04d8b5be104747aa89b954a718b15d76 to your computer and use it in GitHub Desktop.
Timecop Indefinite Wait with `Concurrent::IVar`
source 'https://rubygems.org'
ruby '3.3.0'
gem 'concurrent-ruby', '1.3.1'
gem 'minitest', '5.23.1'
gem 'timecop', '0.9.9'
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
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
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