From 09d7072e5e15cd6ba5c0af2ccc3236c180cd1d21 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Sat, 1 Nov 2014 12:57:18 +0100 Subject: [PATCH] move and rename regex tests --- .../lang/regexp}/BaseParseTestcase.java | 7 +++--- .../intellij/lang/regexp}/ParseTest.java | 4 +-- .../lang/regexp}/RegExpCompletionTest.java | 5 ++-- .../lang/regexp/RegExpParseTest.java} | 18 ++++++------- RegExpSupport/test/test/Main.java | 25 ------------------- 5 files changed, 16 insertions(+), 43 deletions(-) rename RegExpSupport/test/{test => org/intellij/lang/regexp}/BaseParseTestcase.java (94%) rename RegExpSupport/test/{test => org/intellij/lang/regexp}/ParseTest.java (92%) rename RegExpSupport/test/{test => org/intellij/lang/regexp}/RegExpCompletionTest.java (96%) rename RegExpSupport/test/{test/MainParseTest.java => org/intellij/lang/regexp/RegExpParseTest.java} (93%) delete mode 100644 RegExpSupport/test/test/Main.java diff --git a/RegExpSupport/test/test/BaseParseTestcase.java b/RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestcase.java similarity index 94% rename from RegExpSupport/test/test/BaseParseTestcase.java rename to RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestcase.java index efb7b4188d6a..4aa9edbf9d4d 100644 --- a/RegExpSupport/test/test/BaseParseTestcase.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/BaseParseTestcase.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.Result; @@ -26,15 +26,14 @@ import com.intellij.testFramework.fixtures.CodeInsightTestFixture; import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; import com.intellij.testFramework.fixtures.TestFixtureBuilder; -import org.intellij.lang.regexp.RegExpFileType; import java.io.File; -public abstract class BaseParseTestcase extends UsefulTestCase{ +public abstract class BaseParseTestCase extends UsefulTestCase{ protected CodeInsightTestFixture myFixture; @SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"}) - public BaseParseTestcase() { + public BaseParseTestCase() { PlatformTestCase.initPlatformLangPrefix(); } diff --git a/RegExpSupport/test/test/ParseTest.java b/RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java similarity index 92% rename from RegExpSupport/test/test/ParseTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java index 4ab429ad2d38..4ceccc03f2cc 100644 --- a/RegExpSupport/test/test/ParseTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/ParseTest.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; -public class ParseTest extends BaseParseTestcase { +public class ParseTest extends BaseParseTestCase { //public void test0() throws Throwable { // myFixture.testHighlighting("test0.regexp"); diff --git a/RegExpSupport/test/test/RegExpCompletionTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java similarity index 96% rename from RegExpSupport/test/test/RegExpCompletionTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java index 5e90be4a485a..5b128b32699c 100644 --- a/RegExpSupport/test/test/RegExpCompletionTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; import com.intellij.openapi.application.PathManager; import com.intellij.testFramework.PlatformTestCase; import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase; import com.intellij.util.ArrayUtil; -import org.intellij.lang.regexp.DefaultRegExpPropertiesProvider; import java.io.File; import java.util.ArrayList; diff --git a/RegExpSupport/test/test/MainParseTest.java b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java similarity index 93% rename from RegExpSupport/test/test/MainParseTest.java rename to RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java index 7b6914ba2b2a..7aa073894522 100644 --- a/RegExpSupport/test/test/MainParseTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/RegExpParseTest.java @@ -13,11 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package test; +package org.intellij.lang.regexp; -import org.intellij.lang.regexp.RegExpFileType; -import org.intellij.lang.regexp.RegExpLanguageHost; -import org.intellij.lang.regexp.RegExpLanguageHosts; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; @@ -30,7 +27,7 @@ import java.util.Map; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -public class MainParseTest extends BaseParseTestcase { +public class RegExpParseTest extends BaseParseTestCase { private ByteArrayOutputStream myOut; @@ -175,16 +172,19 @@ public class MainParseTest extends BaseParseTestcase { System.out.print("filename = " + name); n++; - final MainParseTest.Test test = myMap.get(name); + final RegExpParseTest.Test test = myMap.get(name); try { if (test.regExpHost != null) { final Class aClass = (Class)Class.forName(test.regExpHost); final RegExpLanguageHost host = aClass.newInstance(); RegExpLanguageHosts.setRegExpHost(host); } - myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern); - myFixture.testHighlighting(test.showWarnings, true, test.showInfo); - RegExpLanguageHosts.setRegExpHost(null); + try { + myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern); + myFixture.testHighlighting(test.showWarnings, true, test.showInfo); + } finally { + RegExpLanguageHosts.setRegExpHost(null); + } if (test.expectedResult == Result.ERR) { System.out.println(" FAILED. Expression incorrectly parsed OK: " + test.pattern); diff --git a/RegExpSupport/test/test/Main.java b/RegExpSupport/test/test/Main.java deleted file mode 100644 index e248d811f0bf..000000000000 --- a/RegExpSupport/test/test/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2006 Sascha Weinreuter - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package test; - -import java.util.regex.Pattern; - -@SuppressWarnings({ "ALL" }) -public class Main { - public static void main(String[] args) { - final Pattern pattern = Pattern.compile("[\\b]"); - } -}