From 460c46a3a78d9956c04543333f6c8f01fa1b0a87 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 7 Apr 2008 18:39:28 +0000 Subject: * load.c (rb_provided): check expanded path for relative path features, loading or loaded features are already expanded in 1.9. * variable.c (rb_autoload_load): no needs to check if provided before rb_require_safe. [ruby-dev:34266] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_autoload.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bootstraptest/test_autoload.rb (limited to 'bootstraptest/test_autoload.rb') diff --git a/bootstraptest/test_autoload.rb b/bootstraptest/test_autoload.rb new file mode 100644 index 000000000..395f1bd7e --- /dev/null +++ b/bootstraptest/test_autoload.rb @@ -0,0 +1,25 @@ +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 +} + +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 +} + +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 +} + +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 +} -- cgit