diff --git a/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile.txt b/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile.txt new file mode 100644 index 000000000000..c241d40079ca --- /dev/null +++ b/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile.txt @@ -0,0 +1,4 @@ +text text text + text text text + text text +text tetetetetet \ No newline at end of file diff --git a/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile_after.txt b/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile_after.txt new file mode 100644 index 000000000000..b6006b7b4e23 --- /dev/null +++ b/platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile_after.txt @@ -0,0 +1,5 @@ +text text text + text text text + + text text +text tetetetetet \ No newline at end of file diff --git a/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEnterActionTest.java b/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEnterActionTest.java new file mode 100644 index 000000000000..4acfb71f9b6d --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEnterActionTest.java @@ -0,0 +1,52 @@ +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.codeInsight; + +import com.intellij.testFramework.PlatformTestUtil; +import org.jetbrains.annotations.NotNull; + +public class PlainTextEnterActionTest extends AbstractEnterActionTestCase { + @NotNull + @Override + protected String getTestDataPath() { + return PlatformTestUtil.getPlatformTestDataPath(); + } + + public void testEnterInTextFile() throws Exception { + doTest("txt"); + } + + public void testEnterWithSpacesAfterCaret() { + doTextTest("txt", "abc ", "abc \n "); + } + + public void testSCR2236() { + doTextTest("txt", "//file/text/text/text", "//file/text/\n" + "text/text"); + } + + public void testUnmatchedBraceAtPlainTextFile() { + // Inspired by IDEA-64060 + doTextTest( + "txt", + " class Foo {", + " class Foo {\n" + + " \n" + + " }" + ); + } + + public void testInJavaDocLikeStringOfPlainTextFile() { + // Inspired by IDEA-65108 + doTextTest( + "txt", + "Here is a list of bullet points:\n" + + "* Bullet one. Bullet two.", + "Here is a list of bullet points:\n" + + "* Bullet one. \n" + + "Bullet two." + ); + } + + public void testIndentCalculationWithTabsInIndent() { + doTextTest("txt", "\t\tabc", "\t\n\t\tabc"); + } +} diff --git a/java/testFramework/src/com/intellij/codeInsight/AbstractEnterActionTestCase.java b/platform/testFramework/src/com/intellij/codeInsight/AbstractEnterActionTestCase.java similarity index 100% rename from java/testFramework/src/com/intellij/codeInsight/AbstractEnterActionTestCase.java rename to platform/testFramework/src/com/intellij/codeInsight/AbstractEnterActionTestCase.java