2008-04-07 14:39:28 -04:00
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
|
|
|
autoload :ZZZ, "./zzz.rb"
|
2008-04-07 19:33:01 -04:00
|
|
|
ZZZ.ok
|
2008-04-07 14:39:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
|
|
|
autoload :ZZZ, "./zzz.rb"
|
|
|
|
require "./zzz.rb"
|
2008-04-07 19:33:01 -04:00
|
|
|
ZZZ.ok
|
2008-04-07 14:39:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
|
|
|
autoload :ZZZ, "./zzz.rb"
|
2008-04-07 19:33:01 -04:00
|
|
|
proc{$SAFE=4; ZZZ.ok}.call
|
2008-04-07 14:39:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
|
|
|
autoload :ZZZ, "./zzz.rb"
|
|
|
|
require "./zzz.rb"
|
2008-04-07 19:33:01 -04:00
|
|
|
proc{$SAFE=4; ZZZ.ok}.call
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
|
|
|
|
autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
|
|
|
|
module M; end
|
|
|
|
Thread.new{M.instance_eval('$SAFE=4; ZZZ.new.hoge')}.value
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
|
|
|
|
autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
|
|
|
|
module M; end
|
|
|
|
Thread.new{$SAFE=4; M.instance_eval('ZZZ.new.hoge')}.value
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
|
|
|
|
autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
|
|
|
|
Thread.new{$SAFE=4; eval('ZZZ.new.hoge')}.value
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 'ok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
|
|
|
|
autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
|
|
|
|
module M; end
|
|
|
|
Thread.new{eval('$SAFE=4; ZZZ.new.hoge')}.value
|
2008-04-07 14:39:28 -04:00
|
|
|
}
|
2008-12-04 13:29:20 -05:00
|
|
|
|
|
|
|
assert_equal 'okok', %q{
|
|
|
|
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
|
|
|
autoload :ZZZ, "./zzz.rb"
|
|
|
|
t1 = Thread.new {ZZZ.ok}
|
|
|
|
t2 = Thread.new {ZZZ.ok}
|
|
|
|
[t1.value, t2.value].join
|
|
|
|
}
|
|
|
|
|
2009-01-31 15:19:44 -05:00
|
|
|
assert_finish 5, %q{
|
|
|
|
autoload :ZZZ, File.expand_path(__FILE__)
|
|
|
|
begin
|
|
|
|
ZZZ
|
|
|
|
rescue NameError
|
|
|
|
end
|
|
|
|
}, '[ruby-core:21696]'
|
|
|
|
|
2009-02-12 10:48:44 -05:00
|
|
|
assert_equal 'A::C', %q{
|
|
|
|
open("zzz.rb", "w") {}
|
|
|
|
class A
|
2009-06-22 03:28:33 -04:00
|
|
|
autoload :C, "./zzz"
|
2009-02-12 10:48:44 -05:00
|
|
|
class C
|
|
|
|
end
|
|
|
|
C
|
|
|
|
end
|
|
|
|
}
|