summaryrefslogtreecommitdiff
path: root/jni/ruby/bootstraptest/test_load.rb
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/bootstraptest/test_load.rb
Fresh start
Diffstat (limited to 'jni/ruby/bootstraptest/test_load.rb')
-rw-r--r--jni/ruby/bootstraptest/test_load.rb27
1 files changed, 27 insertions, 0 deletions
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]'