From 3615453fceadcccf8ee093caa9b006068202e2b0 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 28 Sep 2009 15:35:02 +0400 Subject: [PATCH] fix path to regexp testdata --- RegExpSupport/test/test/BaseParseTestcase.java | 11 +++++++++-- RegExpSupport/test/test/RegExpCompletionTest.java | 13 ++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/RegExpSupport/test/test/BaseParseTestcase.java b/RegExpSupport/test/test/BaseParseTestcase.java index b087fb2ceb1d..dcf56270c868 100644 --- a/RegExpSupport/test/test/BaseParseTestcase.java +++ b/RegExpSupport/test/test/BaseParseTestcase.java @@ -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() { diff --git a/RegExpSupport/test/test/RegExpCompletionTest.java b/RegExpSupport/test/test/RegExpCompletionTest.java index 32268f4b6a72..5380d545ee0c 100644 --- a/RegExpSupport/test/test/RegExpCompletionTest.java +++ b/RegExpSupport/test/test/RegExpCompletionTest.java @@ -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"; } }