From 6843b8a3f13f313ba5400a60c03654817dca0f6b Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 13 May 2022 19:03:05 +0200 Subject: [PATCH] Move plain text-specific part of EnterActionTest to platform-tests module GitOrigin-RevId: 732eae92ffc94e0c792f7b263ffe0415cdeb0225 --- .../enterAction/EnterInTextFile.txt | 4 ++ .../enterAction/EnterInTextFile_after.txt | 5 ++ .../codeInsight/PlainTextEnterActionTest.java | 52 +++++++++++++++++++ .../AbstractEnterActionTestCase.java | 0 4 files changed, 61 insertions(+) create mode 100644 platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile.txt create mode 100644 platform/platform-tests/testData/codeInsight/enterAction/EnterInTextFile_after.txt create mode 100644 platform/platform-tests/testSrc/com/intellij/codeInsight/PlainTextEnterActionTest.java rename {java => platform}/testFramework/src/com/intellij/codeInsight/AbstractEnterActionTestCase.java (100%) 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