Skip to content

Commit

Permalink
Revert "This is a fix for bug ID 2964. The URL to see the write up is…
Browse files Browse the repository at this point in the history
… here:"

This reverts commit 6556c49.

normalizeSeps would make all internalized paths use \ insted of / on
windows and we use this path as a string by lots of Ruby methods all
expecting the separator to be /.
enebo committed Jul 8, 2015
1 parent 1a5daea commit ebc3585
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/JRubyFile.java
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ private static FileResource createResource(Ruby runtime, String cwd, String path

public static String normalizeSeps(String path) {
if (Platform.IS_WINDOWS) {
return path.replace('/', File.separatorChar);
return path.replace(File.separatorChar, '/');
} else {
return path;
}
9 changes: 4 additions & 5 deletions core/src/test/java/org/jruby/test/TestKernel.java
Original file line number Diff line number Diff line change
@@ -31,7 +31,8 @@
***** END LICENSE BLOCK *****/
package org.jruby.test;

import java.io.File;
import java.util.ArrayList;

import org.jruby.Ruby;
import org.jruby.RubyException;
import org.jruby.RubyFixnum;
@@ -60,16 +61,14 @@ public void testLoad() throws Exception {
assertEquals("load did not load the same file several times", "1", eval("load '../test/loadTest.rb'"));
}


public void testRequire() throws Exception {
char s = File.separatorChar;
//reset the $loadTestvar
eval("$loadTest = nil");
assertEquals("failed to load the file test/loadTest", "0", eval("require '../test/loadTest'"));
assertEquals("incorrectly reloaded the file test/loadTest", "", eval("require '../test/loadTest'"));
assertEquals("incorrect value for $\" variable", "true", eval("print $\"[-1].end_with?('test" + s + "loadTest.rb')"));
}

assertEquals("incorrect value for $\" variable", "true", eval("print $\"[-1].end_with?('test/loadTest.rb')"));
}

public void testPrintf() throws Exception {
assertEquals("hello", eval("printf(\"%s\", \"hello\")"));

0 comments on commit ebc3585

Please sign in to comment.