diff --git a/platform/platform-tests/intellij.platform.tests.iml b/platform/platform-tests/intellij.platform.tests.iml index 2ce4610ef3a9..95223c887a23 100644 --- a/platform/platform-tests/intellij.platform.tests.iml +++ b/platform/platform-tests/intellij.platform.tests.iml @@ -17,7 +17,7 @@ - + diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/1.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/1.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/1.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/1.cs diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/1_after.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/1_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/1_after.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/1_after.cs diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/2.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/2.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/2.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/2.cs diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/2_after.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/2_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/2_after.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/2_after.cs diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/Erlang.erl b/platform/platform-tests/testData/codeInsight/completion/customFileType/Erlang.erl similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/Erlang.erl rename to platform/platform-tests/testData/codeInsight/completion/customFileType/Erlang.erl diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/WordCompletion.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/WordCompletion.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/WordCompletion.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/WordCompletion.cs diff --git a/java/java-tests/testData/codeInsight/completion/customFileType/foo.cs b/platform/platform-tests/testData/codeInsight/completion/customFileType/foo.cs similarity index 100% rename from java/java-tests/testData/codeInsight/completion/customFileType/foo.cs rename to platform/platform-tests/testData/codeInsight/completion/customFileType/foo.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnter.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnter.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnter.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnter.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnterJavaFx.fx b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnterJavaFx.fx similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnterJavaFx.fx rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnterJavaFx.fx diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnterJavaFx_after.fx b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnterJavaFx_after.fx similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnterJavaFx_after.fx rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnterJavaFx_after.fx diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnter_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnter_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertBraceOnEnter_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertBraceOnEnter_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket_after2.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket_after2.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteBracket_after2.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteBracket_after2.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_2.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_2.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_2.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_2.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_2_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_2_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_2_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_2_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth2_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth2_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth_after2.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth_after2.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteParenth_after2.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteParenth_after2.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.aj b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.aj similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.aj rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.aj diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.pl b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.pl similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote.pl rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote.pl diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.aj b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.aj similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.aj rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.aj diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.pl b/platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.pl similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/InsertDeleteQuote_after.pl rename to platform/platform-tests/testData/editor/actionsInCustomFileType/InsertDeleteQuote_after.pl diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/blockNavigation.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/blockNavigation.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/blockNavigation.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/blockNavigation.cs diff --git a/java/java-tests/testData/codeInsight/defaultAction/customFileType/blockNavigation_after.cs b/platform/platform-tests/testData/editor/actionsInCustomFileType/blockNavigation_after.cs similarity index 100% rename from java/java-tests/testData/codeInsight/defaultAction/customFileType/blockNavigation_after.cs rename to platform/platform-tests/testData/editor/actionsInCustomFileType/blockNavigation_after.cs diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeInspectionTest.groovy b/platform/platform-tests/testSrc/com/intellij/codeHighlighting/CustomFileTypeInspectionTest.groovy similarity index 85% rename from java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeInspectionTest.groovy rename to platform/platform-tests/testSrc/com/intellij/codeHighlighting/CustomFileTypeInspectionTest.groovy index 694a57e737e8..aa3b04139c21 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeInspectionTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/codeHighlighting/CustomFileTypeInspectionTest.groovy @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.java.codeInsight.completion +package com.intellij.codeHighlighting import com.intellij.spellchecker.inspections.SpellCheckingInspection -import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase +import com.intellij.testFramework.fixtures.BasePlatformTestCase import groovy.transform.CompileStatic /** * @author peter */ @CompileStatic -class CustomFileTypeInspectionTest extends LightJavaCodeInsightFixtureTestCase { +class CustomFileTypeInspectionTest extends BasePlatformTestCase { void testSpellChecking() { myFixture.configureByText 'a.hs', ''' diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeAutopopupTest.groovy b/platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeAutopopupTest.groovy similarity index 95% rename from java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeAutopopupTest.groovy rename to platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeAutopopupTest.groovy index f40752596870..f99af3dbca4a 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeAutopopupTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeAutopopupTest.groovy @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.java.codeInsight.completion +package com.intellij.codeInsight.completion import com.intellij.testFramework.fixtures.CompletionAutoPopupTestCase import groovy.transform.CompileStatic diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeCompletionTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeCompletionTest.java similarity index 53% rename from java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeCompletionTest.java rename to platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeCompletionTest.java index 0000ef679ff7..5ffc77fe3e21 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CustomFileTypeCompletionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/completion/CustomFileTypeCompletionTest.java @@ -13,61 +13,69 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.java.codeInsight.completion; +package com.intellij.codeInsight.completion; -import com.intellij.JavaTestUtil; -import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase; import com.intellij.openapi.fileTypes.MockLanguageFileType; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; -import org.jetbrains.annotations.NotNull; +import com.intellij.testFramework.UsefulTestCase; +import com.intellij.testFramework.fixtures.BasePlatformTestCase; +import junit.framework.TestCase; /** * @author Maxim.Mossienko */ -public class CustomFileTypeCompletionTest extends LightFixtureCompletionTestCase { - private static final String BASE_PATH = "/codeInsight/completion/customFileType/"; +public class CustomFileTypeCompletionTest extends BasePlatformTestCase { - @NotNull @Override - protected String getTestDataPath() { - return JavaTestUtil.getJavaTestDataPath(); + protected String getBasePath() { + return "platform/platform-tests/testData/codeInsight/completion/customFileType/"; + } + + @Override + protected boolean isCommunity() { + return true; } public void testKeyWordCompletion() { - configureByFile(BASE_PATH + "1.cs"); - checkResultByFile(BASE_PATH + "1_after.cs"); + myFixture.configureByFile("1.cs"); + myFixture.complete(CompletionType.BASIC); + myFixture.checkResultByFile("1_after.cs"); - configureByFile(BASE_PATH + "2.cs"); - checkResultByFile(BASE_PATH + "2_after.cs"); + myFixture.configureByFile("2.cs"); + myFixture.complete(CompletionType.BASIC); + myFixture.checkResultByFile("2_after.cs"); } public void testWordCompletion() { - configureByFile(BASE_PATH + "WordCompletion.cs"); + myFixture.configureByFile("WordCompletion.cs"); + myFixture.complete(CompletionType.BASIC); myFixture.assertPreferredCompletionItems(0, "while", "whiwhiwhi"); } public void testErlang() { - configureByFile(BASE_PATH + "Erlang.erl"); + myFixture.configureByFile("Erlang.erl"); + myFixture.complete(CompletionType.BASIC); myFixture.assertPreferredCompletionItems(0, "case", "catch"); } public void testComment() { - configureByFile(BASE_PATH + "foo.cs"); - assertEmpty(myFixture.getLookupElements()); + myFixture.configureByFile("foo.cs"); + myFixture.complete(CompletionType.BASIC); + UsefulTestCase.assertEmpty(myFixture.getLookupElements()); } public void testEmptyFile() { myFixture.configureByText("a.cs", ""); - complete(); - assertTrue(myFixture.getLookupElementStrings().contains("abstract")); - assertFalse(myFixture.getLookupElementStrings().contains("x")); + myFixture.complete(CompletionType.BASIC); + TestCase.assertTrue(myFixture.getLookupElementStrings().contains("abstract")); + TestCase.assertFalse(myFixture.getLookupElementStrings().contains("x")); } public void testPlainTextSubstitution() { PsiFile file = PsiFileFactory.getInstance(getProject()).createFileFromText("a.xxx", MockLanguageFileType.INSTANCE, "aaa a", 0, true); myFixture.configureFromExistingVirtualFile(file.getViewProvider().getVirtualFile()); - complete(); + myFixture.complete(CompletionType.BASIC); myFixture.checkResult("aaa aaa"); } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/defaultAction/CustomFileTypeEditorTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/editorActions/CustomFileTypeEditorTest.java similarity index 51% rename from java/java-tests/testSrc/com/intellij/java/codeInsight/defaultAction/CustomFileTypeEditorTest.java rename to platform/platform-tests/testSrc/com/intellij/codeInsight/editorActions/CustomFileTypeEditorTest.java index 0f30a22addd0..c0b240fba84c 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/defaultAction/CustomFileTypeEditorTest.java +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/editorActions/CustomFileTypeEditorTest.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2017 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.java.codeInsight.defaultAction; +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.codeInsight.editorActions; import com.intellij.codeInsight.CodeInsightSettings; -import com.intellij.codeInsight.editorActions.CodeBlockEndAction; -import com.intellij.codeInsight.editorActions.CodeBlockStartAction; import com.intellij.ide.highlighter.HighlighterFactory; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; +import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.openapi.fileTypes.FileType; @@ -28,36 +13,46 @@ import com.intellij.openapi.fileTypes.impl.AbstractFileType; import com.intellij.psi.CustomHighlighterTokenType; import com.intellij.psi.StringEscapesTokenTypes; import com.intellij.testFramework.EditorTestUtil; -import com.intellij.testFramework.LightJavaCodeInsightTestCase; +import com.intellij.testFramework.fixtures.BasePlatformTestCase; +import junit.framework.TestCase; import static com.intellij.testFramework.EditorTestUtil.BACKSPACE_FAKE_CHAR; /** * @author Maxim.Mossienko */ -public class CustomFileTypeEditorTest extends LightJavaCodeInsightTestCase { - private static final String BASE_PATH = "/codeInsight/defaultAction/customFileType/"; +public class CustomFileTypeEditorTest extends BasePlatformTestCase { + + @Override + protected String getBasePath() { + return "platform/platform-tests/testData/editor/actionsInCustomFileType"; + } + + @Override + protected boolean isCommunity() { + return true; + } private void _testBlockNavigation(String test, String ext) { - configureByFile(BASE_PATH + test + "." + ext); + myFixture.configureByFile(test + "." + ext); performEndBlockAction(); - checkResultByFile(BASE_PATH + test + "_after." + ext); + myFixture.checkResultByFile(test + "_after." + ext); - configureByFile(BASE_PATH + test + "_after." + ext); + myFixture.configureByFile(test + "_after." + ext); performStartBlockAction(); - checkResultByFile(BASE_PATH + test + "." + ext); + myFixture.checkResultByFile(test + "." + ext); } private void performStartBlockAction() { EditorActionHandler actionHandler = new CodeBlockStartAction().getHandler(); - - actionHandler.execute(getEditor(), getCurrentEditorDataContext()); + actionHandler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getPrimaryCaret(), + ((EditorEx)myFixture.getEditor()).getDataContext()); } private void performEndBlockAction() { EditorActionHandler actionHandler = new CodeBlockEndAction().getHandler(); - - actionHandler.execute(getEditor(), getCurrentEditorDataContext()); + actionHandler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getPrimaryCaret(), + ((EditorEx)myFixture.getEditor()).getDataContext()); } public void testBlockNavigation() { @@ -65,73 +60,73 @@ public class CustomFileTypeEditorTest extends LightJavaCodeInsightTestCase { } public void testInsertDeleteQuotes() { - configureByFile(BASE_PATH + "InsertDeleteQuote.cs"); - EditorTestUtil.performTypingAction(getEditor(), '"'); - checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.cs"); + myFixture.configureByFile("InsertDeleteQuote.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '"'); + myFixture.checkResultByFile("InsertDeleteQuote_after.cs"); - configureByFile(BASE_PATH+"InsertDeleteQuote_after.cs"); - EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR); - checkResultByFile(BASE_PATH+"InsertDeleteQuote.cs"); + myFixture.configureByFile("InsertDeleteQuote_after.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR); + myFixture.checkResultByFile("InsertDeleteQuote.cs"); FileType extension = FileTypeManager.getInstance().getFileTypeByExtension("pl"); - assertTrue("Test is not set up correctly:"+extension, extension instanceof AbstractFileType); - configureByFile(BASE_PATH + "InsertDeleteQuote.pl"); - EditorTestUtil.performTypingAction(getEditor(), '"'); - checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.pl"); + TestCase.assertTrue("Test is not set up correctly:" + extension, extension instanceof AbstractFileType); + myFixture.configureByFile("InsertDeleteQuote.pl"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '"'); + myFixture.checkResultByFile("InsertDeleteQuote_after.pl"); - configureByFile(BASE_PATH+"InsertDeleteQuote_after.pl"); - EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR); - checkResultByFile(BASE_PATH+"InsertDeleteQuote.pl"); + myFixture.configureByFile("InsertDeleteQuote_after.pl"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR); + myFixture.checkResultByFile("InsertDeleteQuote.pl"); - configureByFile(BASE_PATH + "InsertDeleteQuote.aj"); - EditorTestUtil.performTypingAction(getEditor(), '"'); - checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.aj"); + myFixture.configureByFile("InsertDeleteQuote.aj"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '"'); + myFixture.checkResultByFile("InsertDeleteQuote_after.aj"); - configureByFile(BASE_PATH+"InsertDeleteQuote_after.aj"); - EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR); - checkResultByFile(BASE_PATH+"InsertDeleteQuote.aj"); + myFixture.configureByFile("InsertDeleteQuote_after.aj"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR); + myFixture.checkResultByFile("InsertDeleteQuote.aj"); } public void testInsertDeleteBracket() { - configureByFile(BASE_PATH + "InsertDeleteBracket.cs"); - EditorTestUtil.performTypingAction(getEditor(), '['); - checkResultByFile(BASE_PATH + "InsertDeleteBracket_after.cs"); + myFixture.configureByFile("InsertDeleteBracket.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '['); + myFixture.checkResultByFile("InsertDeleteBracket_after.cs"); - configureByFile(BASE_PATH+"InsertDeleteBracket_after.cs"); - EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR); - checkResultByFile(BASE_PATH+"InsertDeleteBracket.cs"); + myFixture.configureByFile("InsertDeleteBracket_after.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR); + myFixture.checkResultByFile("InsertDeleteBracket.cs"); - configureByFile(BASE_PATH+"InsertDeleteBracket_after.cs"); - EditorTestUtil.performTypingAction(getEditor(), ']'); - checkResultByFile(BASE_PATH + "InsertDeleteBracket_after2.cs"); + myFixture.configureByFile("InsertDeleteBracket_after.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), ']'); + myFixture.checkResultByFile("InsertDeleteBracket_after2.cs"); } public void testInsertDeleteParenth() { - configureByFile(BASE_PATH + "InsertDeleteParenth.cs"); - EditorTestUtil.performTypingAction(getEditor(), '('); - checkResultByFile(BASE_PATH + "InsertDeleteParenth_after.cs"); + myFixture.configureByFile("InsertDeleteParenth.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); + myFixture.checkResultByFile("InsertDeleteParenth_after.cs"); - configureByFile(BASE_PATH+"InsertDeleteParenth_after.cs"); - EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR); - checkResultByFile(BASE_PATH+"InsertDeleteParenth.cs"); + myFixture.configureByFile("InsertDeleteParenth_after.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), BACKSPACE_FAKE_CHAR); + myFixture.checkResultByFile("InsertDeleteParenth.cs"); - configureByFile(BASE_PATH+"InsertDeleteParenth_after.cs"); - EditorTestUtil.performTypingAction(getEditor(), ')'); - checkResultByFile(BASE_PATH+"InsertDeleteParenth_after2.cs"); + myFixture.configureByFile("InsertDeleteParenth_after.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), ')'); + myFixture.checkResultByFile("InsertDeleteParenth_after2.cs"); - configureByFile(BASE_PATH + "InsertDeleteParenth2_2.cs"); - EditorTestUtil.performTypingAction(getEditor(), '('); - checkResultByFile(BASE_PATH + "InsertDeleteParenth2_2_after.cs"); + myFixture.configureByFile("InsertDeleteParenth2_2.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); + myFixture.checkResultByFile("InsertDeleteParenth2_2_after.cs"); - configureByFile(BASE_PATH + "InsertDeleteParenth2.cs"); - EditorTestUtil.performTypingAction(getEditor(), '('); - checkResultByFile(BASE_PATH + "InsertDeleteParenth2_after.cs"); + myFixture.configureByFile("InsertDeleteParenth2.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); + myFixture.checkResultByFile("InsertDeleteParenth2_after.cs"); } private void checkTyping(String fileName, String before, char typed, String after) { - configureFromFileText(fileName, before); - EditorTestUtil.performTypingAction(getEditor(), typed); - checkResultByText(after); + myFixture.configureByText(fileName, before); + EditorTestUtil.performTypingAction(myFixture.getEditor(), typed); + myFixture.checkResult(after); } public void testParenthesesBeforeNonWs() { @@ -195,23 +190,23 @@ public class CustomFileTypeEditorTest extends LightJavaCodeInsightTestCase { } public void testClosingBraceInPlainText() { - configureFromFileText("a.txt", ""); - EditorTestUtil.performTypingAction(getEditor(), '('); - EditorTestUtil.performTypingAction(getEditor(), ')'); - checkResultByText("()"); + myFixture.configureByText("a.txt", ""); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '('); + EditorTestUtil.performTypingAction(myFixture.getEditor(), ')'); + myFixture.checkResult("()"); } public void testInsertBraceOnEnter() { - configureByFile(BASE_PATH + "InsertBraceOnEnter.cs"); - EditorTestUtil.performTypingAction(getEditor(), '\n'); - checkResultByFile(BASE_PATH + "InsertBraceOnEnter_after.cs"); + myFixture.configureByFile("InsertBraceOnEnter.cs"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '\n'); + myFixture.checkResultByFile("InsertBraceOnEnter_after.cs"); } public void testInsertBraceOnEnterJavaFx() { String testName = getTestName(false); - configureByFile(BASE_PATH + testName + ".fx"); - EditorTestUtil.performTypingAction(getEditor(), '\n'); - checkResultByFile(BASE_PATH + testName + "_after.fx"); + myFixture.configureByFile(testName + ".fx"); + EditorTestUtil.performTypingAction(myFixture.getEditor(), '\n'); + myFixture.checkResultByFile(testName + "_after.fx"); } public void testCpp() { @@ -219,25 +214,25 @@ public class CustomFileTypeEditorTest extends LightJavaCodeInsightTestCase { // 0123456789012345678 9 0123 45 6 7 highlighter.setText("#include try enum \"\\xff\\z\\\"xxx\""); HighlighterIterator iterator = highlighter.createIterator(2); - assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); iterator = highlighter.createIterator(9); - assertEquals(CustomHighlighterTokenType.KEYWORD_2, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.KEYWORD_2, iterator.getTokenType()); iterator = highlighter.createIterator(15); - assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); iterator = highlighter.createIterator(19); - assertEquals(StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN, iterator.getTokenType()); + TestCase.assertEquals(StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN, iterator.getTokenType()); iterator = highlighter.createIterator(23); - assertEquals(StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN, iterator.getTokenType()); + TestCase.assertEquals(StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN, iterator.getTokenType()); iterator = highlighter.createIterator(25); - assertEquals(StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN, iterator.getTokenType()); + TestCase.assertEquals(StringEscapesTokenTypes.VALID_STRING_ESCAPE_TOKEN, iterator.getTokenType()); iterator = highlighter.createIterator(27); - assertEquals(CustomHighlighterTokenType.STRING, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.STRING, iterator.getTokenType()); } public void testHaskel() { @@ -245,9 +240,9 @@ public class CustomFileTypeEditorTest extends LightJavaCodeInsightTestCase { // 0123456789012345678 9 0123 45 6 7 highlighter.setText("{-# #-} module"); HighlighterIterator iterator = highlighter.createIterator(2); - assertEquals(CustomHighlighterTokenType.MULTI_LINE_COMMENT, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.MULTI_LINE_COMMENT, iterator.getTokenType()); iterator = highlighter.createIterator(12); - assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); + TestCase.assertEquals(CustomHighlighterTokenType.KEYWORD_1, iterator.getTokenType()); } }