move and rename regex tests

This commit is contained in:
Bas Leijdekkers
2014-11-01 12:57:18 +01:00
parent 6259a057c3
commit 09d7072e5e
5 changed files with 16 additions and 43 deletions
@@ -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();
}
@@ -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");
@@ -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;
@@ -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<RegExpLanguageHost> aClass = (Class<RegExpLanguageHost>)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);
-25
View File
@@ -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]");
}
}