2 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
3 autoload :ZZZ, "./zzz.rb"
8 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
9 autoload :ZZZ, "./zzz.rb"
14 assert_equal 'ok', %q{
15 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
16 autoload :ZZZ, "./zzz.rb"
17 proc{$SAFE=4; ZZZ.ok}.call
20 assert_equal 'ok', %q{
21 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
22 autoload :ZZZ, "./zzz.rb"
24 proc{$SAFE=4; ZZZ.ok}.call
27 assert_equal 'ok', %q{
28 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
29 autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
31 Thread.new{M.instance_eval('$SAFE=4; ZZZ.new.hoge')}.value
34 assert_equal 'ok', %q{
35 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
36 autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
38 Thread.new{$SAFE=4; M.instance_eval('ZZZ.new.hoge')}.value
41 assert_equal 'ok', %q{
42 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
43 autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
44 Thread.new{$SAFE=4; eval('ZZZ.new.hoge')}.value
47 assert_equal 'ok', %q{
48 open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
49 autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
51 Thread.new{eval('$SAFE=4; ZZZ.new.hoge')}.value