From: Aaron Patterson Date: 2013-04-06T09:37:44+09:00 Subject: [ruby-core:54045] Re: Question about r39944 On Sat, Apr 06, 2013 at 08:41:46AM +0900, Tanaka Akira wrote: > 2013/4/6 Aaron Patterson : > > Can you give me a specific example of how you're running the tests? It > > seems we should make sure the load path is always correct rather than > > couple the source file to it's location in the file system. > > In general, require_relative is a good tool to require a utility > library for a test. > > For example, test/objspace/test_objspace.rb uses test/ruby/envutil.rb. Ok. So if you move `test_objspace.rb` to 'test/foo/bar', now you have to modify the source of `test_objspace.rb`. Why does the source file depend on the file system location? > But I want to invoke the test as follows. > > % ./ruby test/objspace/test_objspace.rb > > Since test/ruby/ is not a standard library location, > the load path doesn't contain it. > > So, if "require" is used instead of "require_relative", > I need to invoke ruby with -Itest/ruby or test_objspace.rb needs to > tweak the load path which is irritative. export RUBYOPT='-Itest/ruby' ;-) -- Aaron Patterson http://tenderlovemaking.com/