Skip to content

Commit

Permalink
Make newer version of kernel test directory agnostic as well
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@4817 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
nicksieger committed Oct 30, 2007
1 parent 7e17936 commit e58ac2b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/test_kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,22 @@ def test_load_should_call_to_str_on_arg
end

def test_shall_load_from_load_path
begin
File.open(File.expand_path('.') +'/file_to_be_loaded','w' ) do |f|
f.puts "raise"
tmp = ENV["TEMP"] || ENV["TMP"] || ENV["TMPDIR"] || "/tmp"
Dir.chdir(tmp) do
load_path_save = $LOAD_PATH
begin
File.open(File.expand_path('.') +'/file_to_be_loaded','w' ) do |f|
f.puts "raise"
end
$LOAD_PATH.delete_if{|dir| dir=='.'}
assert_raise(LoadError) {
load 'file_to_be_loaded'
}
ensure
File.delete(File.expand_path('.') +'/file_to_be_loaded')
$LOAD_PATH.clear
$LOAD_PATH << load_path_save
end
$LOAD_PATH.delete_if{|dir| dir=='.'}
assert_raise(LoadError) {
load 'file_to_be_loaded'
}
ensure
File.delete(File.expand_path('.') +'/file_to_be_loaded')
end
end

Expand Down

0 comments on commit e58ac2b

Please sign in to comment.