Skip to content

Commit

Permalink
remove useless initial load path entries of the ScriptingContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Oct 16, 2014
1 parent 3388591 commit 074bbfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/embed/ScriptingContainer.java
Expand Up @@ -252,8 +252,6 @@ private LocalContextProvider getProviderInstance(LocalContextScope scope, LocalV
}

private void initConfig() throws URISyntaxException, UnsupportedEncodingException {
List<String> paths = SystemPropertyCatcher.findLoadPaths();
provider.getRubyInstanceConfig().setLoadPaths(paths);
String home = SystemPropertyCatcher.findJRubyHome(this);
if (home != null) {
provider.getRubyInstanceConfig().setJRubyHome(home);
Expand Down
14 changes: 12 additions & 2 deletions core/src/test/java/org/jruby/embed/ScriptingContainerTest.java
Expand Up @@ -1550,9 +1550,9 @@ public void testGetLoadPaths() {
instance.setOutput(pstream);
instance.setWriter(writer);
instance.setErrorWriter(writer);
List result = instance.getLoadPaths();
List<String> result = instance.getLoadPaths();
assertTrue(result != null);
assertTrue(result.size() > 0);
assertTrue(result.size() == 0);

instance = null;
}
Expand Down Expand Up @@ -2630,4 +2630,14 @@ public void testExitTerminatesScript() {
Object result = instance.runScriptlet("exit 1234");
assertEquals(1234L, result);
}

@Test
public void testLoadPathOfScriptingContainer() {
ScriptingContainer instance = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
// note that instance.getLoadPath is not the load-path of the runtime !!!
String[] results = instance.runScriptlet("$LOAD_PATH").toString().split(", ");
for(String result : results){
assertTrue(result + " containt lib/ruby/", result.contains("lib/ruby/"));
}
}
}

0 comments on commit 074bbfc

Please sign in to comment.