mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
split tests according to expected language level
This commit is contained in:
@@ -48,7 +48,7 @@ class LambdaTest2<TypeParam> {
|
||||
U map(T t);
|
||||
}
|
||||
|
||||
public <U> LambdaTest<U> map(final Mapper<? super TypeParam, ? extends U> mapper) {
|
||||
public <U> LambdaTest2<U> map(final Mapper<? super TypeParam, ? extends U> mapper) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.
|
||||
* 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 com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
|
||||
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This class is for "lightweight" tests only, i.e. those which can run inside default light project set up
|
||||
* For "heavyweight" tests use AdvHighlightingTest
|
||||
*/
|
||||
public class LightAdvHighlightingJdk6Test extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting6";
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos, Class<?>... classes) {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_6);
|
||||
((JavaVersionServiceImpl)JavaVersionService.getInstance()).setTestVersion(JavaSdkVersion.JDK_1_6, myTestRootDisposable);
|
||||
enableInspectionTools(classes);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
}
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkWeakWarnings, boolean checkInfos, Class<?>... classes) {
|
||||
enableInspectionTools(classes);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkWeakWarnings, checkInfos);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LocalInspectionTool[] configureLocalInspectionTools() {
|
||||
return new LocalInspectionTool[]{
|
||||
new UnusedSymbolLocalInspection(),
|
||||
new UncheckedWarningLocalInspection(),
|
||||
new JavacQuirksInspection(),
|
||||
new RedundantCastInspection()
|
||||
};
|
||||
}
|
||||
|
||||
public void testJavacQuirks() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_6); doTest(true, false); }
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.compiler.JavacQuirksInspection;
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
|
||||
import com.intellij.codeInspection.defUse.DefUseInspection;
|
||||
import com.intellij.codeInspection.deprecation.DeprecatedDefenderSyntaxInspection;
|
||||
import com.intellij.codeInspection.redundantCast.RedundantCastInspection;
|
||||
import com.intellij.codeInspection.reference.EntryPoint;
|
||||
import com.intellij.codeInspection.reference.RefElement;
|
||||
@@ -30,6 +29,9 @@ import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jdom.Element;
|
||||
@@ -46,6 +48,8 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/advHighlighting7";
|
||||
|
||||
private void doTest(boolean checkWarnings, boolean checkInfos, Class<?>... classes) {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
((JavaVersionServiceImpl)JavaVersionService.getInstance()).setTestVersion(JavaSdkVersion.JDK_1_7, myTestRootDisposable);
|
||||
enableInspectionTools(classes);
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
}
|
||||
@@ -94,7 +98,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testDiamondNeg12() throws Exception { doTest(false, false); }
|
||||
public void testDiamondNeg13() throws Exception { doTest(false, false); }
|
||||
public void testDiamondNeg14() throws Exception { doTest(false, false); }
|
||||
public void testDiamondMisc() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_7); doTest(false, false); }
|
||||
public void testDiamondMisc() throws Exception { doTest(false, false); }
|
||||
public void testHighlightInaccessibleFromClassModifierList() throws Exception { doTest(false, false); }
|
||||
public void testInnerInTypeArguments() throws Exception { doTest(false, false); }
|
||||
|
||||
@@ -130,7 +134,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testJavacQuirks() throws Exception { setLanguageLevel(LanguageLevel.JDK_1_6); doTest(true, false); }
|
||||
public void testNumericLiterals() throws Exception { doTest(false, false); }
|
||||
public void testMultiCatch() throws Exception { doTest(false, false); }
|
||||
public void testTryWithResources() throws Exception { doTest(false, false); }
|
||||
@@ -147,8 +150,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testExtendsBound() throws Exception { doTest(false, false); }
|
||||
public void testIDEA84533() throws Exception { doTest(false, false); }
|
||||
public void testClassLiteral() throws Exception { doTest(false, false); }
|
||||
public void testExtensionMethods() throws Exception { doTest(false, false); }
|
||||
public void testExtensionMethodSyntax() throws Exception { doTest(true, false, DeprecatedDefenderSyntaxInspection.class); }
|
||||
public void testMethodReferences() throws Exception { doTest(false, true, false); }
|
||||
public void testUsedMethodsByMethodReferences() throws Exception { doTest(true, true, false); }
|
||||
public void testLambdaExpressions() throws Exception { doTest(false, true, false); }
|
||||
@@ -161,9 +162,6 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testUncheckedWarningIDEA99357() throws Exception { doTest(true, false); }
|
||||
public void testUncheckedWarningIDEA26738() throws Exception { doTest(true, false); }
|
||||
public void testUncheckedWarningIDEA99536() throws Exception { doTest(true, false); }
|
||||
public void testDefaultMethodVisibility() throws Exception { doTest(true, false); }
|
||||
public void testInheritUnrelatedDefaults() throws Exception { doTest(true, false); }
|
||||
public void testNotInheritFromUnrelatedDefault() throws Exception { doTest(true, false); }
|
||||
public void testEnclosingInstance() throws Exception { doTest(false, false); }
|
||||
public void testWrongArgsAndUnknownTypeParams() throws Exception { doTest(false, false); }
|
||||
public void testAmbiguousMethodCallIDEA97983() throws Exception { doTest(false, false); }
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.codeInspection.deprecation.DeprecatedDefenderSyntaxInspection;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public class Interface8MethodsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
@@ -24,8 +25,21 @@ public class Interface8MethodsHighlightingTest extends LightDaemonAnalyzerTestCa
|
||||
public void testStaticMethod() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotInheritFromUnrelatedDefault() throws Exception { doTest(true, false); }
|
||||
public void testDefaultMethodVisibility() throws Exception { doTest(true, false); }
|
||||
public void testInheritUnrelatedDefaults() throws Exception { doTest(true, false); }
|
||||
public void testExtensionMethods() throws Exception { doTest(false, false); }
|
||||
public void testExtensionMethodSyntax() throws Exception {
|
||||
enableInspectionTools(DeprecatedDefenderSyntaxInspection.class);
|
||||
doTest(true, false);
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
private void doTest(final boolean checkWarnings, final boolean checkInfos) throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
public class ChangeNewOperatorTypeTest extends LightQuickFix15TestCase {
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
public class ChangeNewOperatorTypeTest extends LightQuickFixTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
doAllTests();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.codeInsight.daemon.quickFix;
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class CreateMethodFromUsageTest extends LightQuickFix15TestCase {
|
||||
public class CreateMethodFromUsageTest extends LightQuickFixTestCase {
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,15 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public abstract class LightQuickFix15TestCase extends LightQuickFixTestCase {
|
||||
@Override
|
||||
protected void doAllTests() throws Exception {
|
||||
setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
super.doAllTests();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.intellij.codeInsight.daemon.quickFix;
|
||||
|
||||
|
||||
public class VariableTypeFromCallTest extends LightQuickFix15TestCase {
|
||||
public class VariableTypeFromCallTest extends LightQuickFixTestCase {
|
||||
|
||||
public void test() throws Exception { doAllTests(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user