From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/bootstraptest/test_load.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 jni/ruby/bootstraptest/test_load.rb (limited to 'jni/ruby/bootstraptest/test_load.rb') diff --git a/jni/ruby/bootstraptest/test_load.rb b/jni/ruby/bootstraptest/test_load.rb new file mode 100644 index 0000000..e63c93a --- /dev/null +++ b/jni/ruby/bootstraptest/test_load.rb @@ -0,0 +1,27 @@ +assert_equal 'ok', %q{ + open("require-lock-test.rb", "w") {|f| + f.puts "sleep 0.1" + f.puts "module M" + f.puts "end" + } + $:.unshift Dir.pwd + vs = (1..2).map {|i| + Thread.start { + require "require-lock-test" + M + } + }.map {|t| t.value } + vs[0] == M && vs[1] == M ? :ok : :ng +}, '[ruby-dev:32048]' + +assert_equal 'ok', %q{ + %w[a a/foo b].each {|d| Dir.mkdir(d)} + open("b/foo", "w") {|f| f.puts "$ok = :ok"} + $:.replace(%w[a b]) + begin + load "foo" + $ok + rescue => e + e.message + end +}, '[ruby-dev:38097]' -- cgit v1.2.3-70-g09d2