fix path to regexp testdata

This commit is contained in:
Dmitry Jemerov
2009-09-28 15:35:02 +04:00
parent 9359aea290
commit 3615453fce
2 changed files with 19 additions and 5 deletions
@@ -27,6 +27,8 @@ import com.intellij.testFramework.fixtures.TestFixtureBuilder;
import junit.framework.TestCase;
import org.intellij.lang.regexp.RegExpFileType;
import java.io.File;
public abstract class BaseParseTestcase extends TestCase {
protected CodeInsightTestFixture myFixture;
@@ -49,8 +51,13 @@ public abstract class BaseParseTestcase extends TestCase {
}
protected String getTestDataRoot() {
return PathManager.getHomePath() + "/svnPlugins/RegExpSupport/testData";
public static String getTestDataRoot() {
String homePath = PathManager.getHomePath();
File candidate = new File(homePath, "community/RegExpSupport");
if (candidate.isDirectory()) {
return new File(candidate, "testData").getPath();
}
return new File(homePath, "RegExpSupport/testData").getPath();
}
protected String getTestDataPath() {
@@ -1,8 +1,10 @@
package test;
import com.intellij.openapi.application.PathManager;
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
import org.intellij.lang.regexp.psi.impl.RegExpPropertyImpl;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@@ -15,11 +17,11 @@ import java.util.Arrays;
public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
// util methods
private String getInputDataFileName(String testName) {
private static String getInputDataFileName(String testName) {
return Character.toUpperCase(testName.charAt(0)) + testName.substring(1) + ".regexp";
}
private String getExpectedResultFileName(String testName) {
private static String getExpectedResultFileName(String testName) {
return Character.toUpperCase(testName.charAt(0)) + testName.substring(1) + "Expected" + ".regexp";
}
@@ -60,6 +62,11 @@ public class RegExpCompletionTest extends CodeInsightFixtureTestCase {
@Override
protected String getBasePath() {
return "/svnPlugins/RegExpSupport/testData/completion";
String homePath = PathManager.getHomePath();
File candidate = new File(homePath, "community/RegExpSupport");
if (candidate.isDirectory()) {
return "/community/RegExpSupport/testData/completion";
}
return "/RegExpSupport/testData/completion";
}
}