Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove add_feature from ensure block

When require method raise LoadError @feature instance is not set.
We need to check also check that req local variable is set. Because
require method could raise exception.
  • Loading branch information...
commit f590a9d5898b1ea16932680aa1edea248c4121a3 1 parent f2cb8fc
@LTe LTe authored
View
5 kernel/delta/codeloader.rb
@@ -40,10 +40,11 @@ def require_compiled(check_version=true)
CodeLoader.loaded_hook.trigger!(@path)
+ add_feature
+
return true
ensure
- add_feature
- req.remove!
+ req.remove! if req
CodeLoader.check_version = saved_check
CodeLoader.source_extension = saved_extension
View
6 spec/core/codeloader/require_compiled_spec.rb
@@ -29,4 +29,10 @@
@loader.require_compiled(@rbc).should be_true
$LOADED_FEATURES.should == [@rb]
end
+
+ it "raise an exception if loader can not load the file" do
+ lambda {
+ Rubinius::CodeLoader.require_compiled("not_an_existing_file")
+ }.should raise_error(LoadError)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.