зеркало из https://github.com/github/ruby.git
* bootstraptest/test_autoload.rb: tests for [ruby-dev:34268].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
37504dc560
Коммит
2d9e9c3fd7
|
@ -1,25 +1,52 @@
|
|||
assert_equal 'ok', %q{
|
||||
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
||||
autoload :ZZZ, "./zzz.rb"
|
||||
print ZZZ.ok
|
||||
ZZZ.ok
|
||||
}
|
||||
|
||||
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"
|
||||
print ZZZ.ok
|
||||
ZZZ.ok
|
||||
}
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
|
||||
autoload :ZZZ, "./zzz.rb"
|
||||
print proc{$SAFE=4; ZZZ.ok}.call
|
||||
proc{$SAFE=4; ZZZ.ok}.call
|
||||
}
|
||||
|
||||
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"
|
||||
print proc{$SAFE=4; ZZZ.ok}.call
|
||||
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
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче