1assert_equal 'ok', %q{ 2 open("require-lock-test.rb", "w") {|f| 3 f.puts "sleep 0.1" 4 f.puts "module M" 5 f.puts "end" 6 } 7 $:.unshift Dir.pwd 8 vs = (1..2).map {|i| 9 Thread.start { 10 require "require-lock-test" 11 M 12 } 13 }.map {|t| t.value } 14 vs[0] == M && vs[1] == M ? :ok : :ng 15}, '[ruby-dev:32048]' 16 17assert_equal 'ok', %q{ 18 %w[a a/foo b].each {|d| Dir.mkdir(d)} 19 open("b/foo", "w") {|f| f.puts "$ok = :ok"} 20 $:.replace(%w[a b]) 21 begin 22 load "foo" 23 $ok 24 rescue => e 25 e.message 26 end 27}, '[ruby-dev:38097]' 28