IDEA plugin: added the error checking to intentions tests.
This commit is contained in:
+3
-3
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.quickfix;
|
||||
package org.jetbrains.jet.plugin;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -36,8 +36,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class QuickFixActionsUtils {
|
||||
private QuickFixActionsUtils() {
|
||||
public class DirectiveBasedActionUtils {
|
||||
private DirectiveBasedActionUtils() {
|
||||
}
|
||||
|
||||
public static void checkForUnexpectedErrors(JetFile file) {
|
||||
@@ -23,6 +23,8 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.DirectiveBasedActionUtils;
|
||||
import org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.*;
|
||||
import org.jetbrains.jet.plugin.intentions.declarations.ConvertMemberToExtension;
|
||||
import org.jetbrains.jet.plugin.intentions.declarations.SplitPropertyDeclarationIntention;
|
||||
@@ -215,6 +217,8 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
|
||||
private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception {
|
||||
configureByFile(path);
|
||||
|
||||
DirectiveBasedActionUtils.checkForUnexpectedErrors((JetFile) getFile());
|
||||
|
||||
String fileText = FileUtil.loadFile(new File(path), true);
|
||||
String isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ");
|
||||
boolean isApplicableExpected = isApplicableString == null || isApplicableString.equals("true");
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.util.ui.UIUtil;
|
||||
import junit.framework.ComparisonFailure;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.DirectiveBasedActionUtils;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.io.File;
|
||||
@@ -76,7 +77,7 @@ public abstract class AbstractQuickFixMultiFileTest extends DaemonAnalyzerTestCa
|
||||
|
||||
boolean actionShouldBeAvailable = pair.getSecond();
|
||||
|
||||
QuickFixActionsUtils.checkForUnexpectedErrors((JetFile) getFile());
|
||||
DirectiveBasedActionUtils.checkForUnexpectedErrors((JetFile) getFile());
|
||||
|
||||
doAction(text, actionShouldBeAvailable, beforeFileName);
|
||||
}
|
||||
@@ -107,7 +108,7 @@ public abstract class AbstractQuickFixMultiFileTest extends DaemonAnalyzerTestCa
|
||||
"Infos:" + infos);
|
||||
}
|
||||
else {
|
||||
QuickFixActionsUtils.checkAvailableActionsAreExpected((JetFile) getFile(), availableActions);
|
||||
DirectiveBasedActionUtils.checkAvailableActionsAreExpected((JetFile) getFile(), availableActions);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.apache.commons.lang.SystemUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.DirectiveBasedActionUtils;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||
@@ -89,13 +90,13 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
||||
}
|
||||
else {
|
||||
// Action shouldn't be found. Check that other actions are expected and thus tested action isn't there under another name.
|
||||
QuickFixActionsUtils.checkAvailableActionsAreExpected((JetFile) getFile(), actions);
|
||||
DirectiveBasedActionUtils.checkAvailableActionsAreExpected((JetFile) getFile(), actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkForUnexpectedErrors() {
|
||||
QuickFixActionsUtils.checkForUnexpectedErrors((JetFile) getFile());
|
||||
DirectiveBasedActionUtils.checkForUnexpectedErrors((JetFile) getFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user