2011-07-10 10:32:06 +04:00
|
|
|
assert_equal 'ok', %q{
|
2022-02-04 21:10:15 +03:00
|
|
|
File.unlink('zzz1.rb') if File.file?('zzz1.rb')
|
2011-07-10 10:32:06 +04:00
|
|
|
instance_eval do
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, './zzz1.rb'
|
2011-07-10 10:32:06 +04:00
|
|
|
begin
|
|
|
|
ZZZ
|
|
|
|
rescue LoadError
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}, '[ruby-dev:43816]'
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write('zzz2.rb', '')
|
2011-07-10 10:32:06 +04:00
|
|
|
instance_eval do
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, './zzz2.rb'
|
2011-07-10 10:32:06 +04:00
|
|
|
begin
|
|
|
|
ZZZ
|
|
|
|
rescue NameError
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}, '[ruby-dev:43816]'
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write('zzz3.rb', "class ZZZ; def self.ok;:ok;end;end\n")
|
2011-07-10 10:32:06 +04:00
|
|
|
instance_eval do
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, './zzz3.rb'
|
2011-07-10 10:32:06 +04:00
|
|
|
ZZZ.ok
|
|
|
|
end
|
|
|
|
}, '[ruby-dev:43816]'
|
|
|
|
|
2008-04-07 22:39:28 +04:00
|
|
|
assert_equal 'ok', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write("zzz4.rb", "class ZZZ; def self.ok;:ok;end;end\n")
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, "./zzz4.rb"
|
2008-04-08 03:33:01 +04:00
|
|
|
ZZZ.ok
|
2008-04-07 22:39:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write("zzz5.rb", "class ZZZ; def self.ok;:ok;end;end\n")
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, "./zzz5.rb"
|
|
|
|
require "./zzz5.rb"
|
2008-04-08 03:33:01 +04:00
|
|
|
ZZZ.ok
|
2008-04-07 22:39:28 +04:00
|
|
|
}
|
|
|
|
|
2008-12-04 21:29:20 +03:00
|
|
|
assert_equal 'okok', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write("zzz6.rb", "class ZZZ; def self.ok;:ok;end;end\n")
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :ZZZ, "./zzz6.rb"
|
2008-12-04 21:29:20 +03:00
|
|
|
t1 = Thread.new {ZZZ.ok}
|
|
|
|
t2 = Thread.new {ZZZ.ok}
|
|
|
|
[t1.value, t2.value].join
|
|
|
|
}
|
|
|
|
|
2009-01-31 23:19:44 +03:00
|
|
|
assert_finish 5, %q{
|
|
|
|
autoload :ZZZ, File.expand_path(__FILE__)
|
|
|
|
begin
|
|
|
|
ZZZ
|
|
|
|
rescue NameError
|
|
|
|
end
|
|
|
|
}, '[ruby-core:21696]'
|
|
|
|
|
2009-02-12 18:48:44 +03:00
|
|
|
assert_equal 'A::C', %q{
|
2024-07-09 07:01:44 +03:00
|
|
|
File.write("zzz7.rb", "")
|
2009-02-12 18:48:44 +03:00
|
|
|
class A
|
2022-02-04 21:10:15 +03:00
|
|
|
autoload :C, "./zzz7"
|
2009-02-12 18:48:44 +03:00
|
|
|
class C
|
|
|
|
end
|
|
|
|
C
|
|
|
|
end
|
|
|
|
}
|