diff options
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_autoload.rb | 40 | ||||
-rw-r--r-- | bootstraptest/test_method.rb | 44 |
2 files changed, 0 insertions, 84 deletions
diff --git a/bootstraptest/test_autoload.rb b/bootstraptest/test_autoload.rb index e8df6684b6..a9f8e6dacd 100644 --- a/bootstraptest/test_autoload.rb +++ b/bootstraptest/test_autoload.rb @@ -43,46 +43,6 @@ assert_equal 'ok', %q{ 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" - 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" - 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 -} - assert_equal 'okok', %q{ open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"} autoload :ZZZ, "./zzz.rb" diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index ed22608aea..4282bc6273 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -886,50 +886,6 @@ class C0; def m *args; [:C0_m, args]; end; end class C1 < C0; def m a, o=:o; super; end; end ; C1.new.m 1, 2} -assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{ - $ans = [] - class Foo - def m - end - end - - c1 = c2 = nil - - lambda{ - $SAFE = 4 - c1 = Class.new{ - def m - end - } - c2 = Class.new(Foo){ - alias mm m - } - }.call - - def test - begin - yield - rescue SecurityError - $ans << :ok - else - $ans << :ng - end - end - - o1 = c1.new - o2 = c2.new - - test{o1.m} - test{o2.mm} - test{o1.send :m} - test{o2.send :mm} - test{o1.public_send :m} - test{o2.public_send :mm} - test{o1.method(:m).call} - test{o2.method(:mm).call} - $ans -} - assert_equal 'ok', %q{ class C def x=(n) |