3 def load_behavior_block(&block)
4 eval("__FILE__", block.binding)
7 class TestLoad < Test::Unit::TestCase
9 # Allow us to run MRI against non-Java dependent tests
10 if RUBY_PLATFORM=~/java/
13 if (File::Separator == '\\')
14 file.gsub!('\\\\', '/')
16 # Load jar file RubyInitTest.java
17 require File::dirname(file) + "/RubyInitTest"
20 # JRUBY-1229, allow loading jar files without manifest
21 assert_nothing_raised {
22 require "test/jar_with_no_manifest.jar"
26 assert require('test/requireTarget')
27 assert !require('test/requireTarget')
29 $loaded_foo_bar = false
30 assert require('test/foo.bar')
31 assert $loaded_foo_bar
34 def test_require_bogus
35 assert_raises(LoadError) { require 'foo/' }
36 assert_raises(LoadError) { require '' }
38 # Yes, the following line is supposed to appear twice
39 assert_raises(LoadError) { require 'NonExistantRequriedFile'}
40 assert_raises(LoadError) { require 'NonExistantRequriedFile'}
43 def test_require_jar_should_make_its_scripts_accessible
44 require 'test/jar_with_ruby_files'
45 require 'hello_from_jar'
49 def test_overriding_require_shouldnt_cause_problems
50 eval(<<DEPS, binding, "deps")
52 alias old_require require
60 require 'test/test_loading_behavior'
62 res = File.expand_path($loading_behavior_result)
64 assert_equal File.expand_path(File.join('test', 'test_loading_behavior.rb')), res