Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Properly fix tests on Windows this time...
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Aug 7, 2015
1 parent 3355cec commit 36dba55
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import static melnorme.utilbox.core.Assert.AssertNamespace.assertFail;
import static melnorme.utilbox.core.Assert.AssertNamespace.assertTrue;

import java.util.regex.Pattern;

import org.json.JSONException;
import org.junit.Test;

Expand All @@ -24,6 +22,7 @@
import melnorme.lang.tooling.ops.SourceLineColumnRange;
import melnorme.utilbox.core.CommonException;
import melnorme.utilbox.misc.MiscUtil;
import melnorme.utilbox.misc.StringUtil;

public class GoOracleFindDefinitionOperation_Test extends CommonGoToolingTest {

Expand All @@ -50,12 +49,12 @@ public class GoOracleFindDefinitionOperation_Test extends CommonGoToolingTest {

String LOC_ROOT = MiscUtil.OS_IS_WINDOWS ? "D:\\devel/" : "/devel/";

testParseResult(fixPaths(getClassResourceAsString("oracle_result.var_ref.json"), LOC_ROOT),
testParseResult(fixPaths(getClassResourceAsString("oracle_result.var_ref.json")),
new FindDefinitionResult(loc(LOC_ROOT+"go-workspace\\src\\github.com\\user\\newmath\\sqrt.go"),
new SourceLineColumnRange(5, 6), null)
);

testParseResult(fixPaths(getClassResourceAsString("oracle_result.type1_ref.json"), LOC_ROOT),
testParseResult(fixPaths(getClassResourceAsString("oracle_result.type1_ref.json")),
new FindDefinitionResult(loc(LOC_ROOT+"DDT\\_runtime\\GoTest\\src\\other\\blah.go"),
new SourceLineColumnRange(16, 6), null)
);
Expand All @@ -67,8 +66,9 @@ public class GoOracleFindDefinitionOperation_Test extends CommonGoToolingTest {
null);
}

protected String fixPaths(String string, String pathRpl) {
return string.replaceAll(Pattern.quote("##ROOT_LOC##"), pathRpl);
protected String fixPaths(String string) {
String pathRpl = MiscUtil.OS_IS_WINDOWS ? "D:\\\\devel/" : "/devel/";
return StringUtil.replaceAll(string, "##ROOT_LOC##", pathRpl);
}

protected void testParseResult(String toolOutput, FindDefinitionResult expectedResult) throws JSONException,
Expand Down

0 comments on commit 36dba55

Please sign in to comment.