Skip to content
Permalink
Browse files
Merge pull request #2051 from jruby/load-path-prepopulation
remove useless initial load path entries of the ScriptingContainer
  • Loading branch information
headius committed Nov 2, 2014
2 parents 1720247 + 074bbfc commit b365fa8476af93d09bc309ae136c09fdbbe7d700
Showing 2 changed files with 12 additions and 4 deletions.
@@ -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);
@@ -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;
}
@@ -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 b365fa8

Please sign in to comment.