summaryrefslogtreecommitdiff
path: root/bootstraptest/test_autoload.rb
diff options
context:
space:
mode:
Diffstat (limited to 'bootstraptest/test_autoload.rb')
-rw-r--r--bootstraptest/test_autoload.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/bootstraptest/test_autoload.rb b/bootstraptest/test_autoload.rb
new file mode 100644
index 0000000000..395f1bd7e3
--- /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
+}