aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-06 23:38:33 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-06 23:38:33 +0000
commitd576a25c26ea6765254e7ec247f951d6bb944703 (patch)
tree6d2dfbf2f25905f8927f04c9c21d93be796d2b08 /test
parentc95cfa0a16305ffb2d701cb2f54bac8b501d86d5 (diff)
downloadruby-d576a25c26ea6765254e7ec247f951d6bb944703.tar.gz
* error.c (rb_loaderror_with_path): Adding the missing file as an
instance variable to the LoadError exception. * load.c: call rb_loaderror_with_path so that the missing path is added to the exception. * ruby.c: call rb_loaderror rather than raising our own LoadError exception. * include/ruby/intern.h: add declaration for rb_loaderror_with_path. * test/ruby/test_require.rb: add supporting test for LoadError#path method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_require.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb
index 379efec58a..e0e885dce6 100644
--- a/test/ruby/test_require.rb
+++ b/test/ruby/test_require.rb
@@ -5,6 +5,14 @@ require_relative 'envutil'
require 'tmpdir'
class TestRequire < Test::Unit::TestCase
+ def test_load_error_path
+ filename = "should_not_exist"
+ error = assert_raises(LoadError) do
+ require filename
+ end
+ assert_equal filename, error.path
+ end
+
def test_require_invalid_shared_object
t = Tempfile.new(["test_ruby_test_require", ".so"])
t.puts "dummy"