Review and fix raw string quotes inserting and remove (KT-2582)

- Add more tests
 - Fix inserting close quotes after multiline string in file end
 - Use parent instead of parentOfType where possible
 - Add bunch files

 #KT-2582 Fixed
This commit is contained in:
Nikolay Krasko
2018-04-28 15:48:24 +03:00
parent 8252b35ed5
commit af930b8364
15 changed files with 98 additions and 27 deletions
@@ -74,10 +74,46 @@ class TypedHandlerTest : LightCodeInsightTestCase() {
"""val x = "$dollar{}]" """
)
fun testAutoCloseRawString() = doCharTypeTest(
fun testAutoCloseRawStringInEnd() = doCharTypeTest(
'"',
"""val x = ""<caret>""",
"""val x = ""${'"'}"<caret>""${'"'}"""
"""val x = ""${'"'}<caret>""${'"'}"""
)
fun testNoAutoCloseRawStringInEnd() = doCharTypeTest(
'"',
"""val x = ""${'"'}<caret>""",
"""val x = ""${'"'}""""
)
fun testAutoCloseRawStringInMiddle() = doCharTypeTest(
'"',
"""
val x = ""<caret>
val y = 12
""".trimIndent(),
"""
val x = ""${'"'}<caret>""${'"'}
val y = 12
""".trimIndent()
)
fun testNoAutoCloseBetweenMultiQuotes() = doCharTypeTest(
'"',
"""val x = ""${'"'}<caret>${'"'}""/**/""",
"""val x = ""${'"'}${'"'}<caret>""/**/"""
)
fun testNoAutoCloseBetweenMultiQuotes1() = doCharTypeTest(
'"',
"""val x = ""${'"'}"<caret>"${'"'}/**/""",
"""val x = ""${'"'}""<caret>${'"'}/**/"""
)
fun testNoAutoCloseAfterEscape() = doCharTypeTest(
'"',
"""val x = "\""<caret>""",
"""val x = "\""${'"'}<caret>""""
)
fun testAutoCloseBraceInFunctionDeclaration() = doCharTypeTest(
@@ -29,6 +29,21 @@ public class BackspaceHandlerTestGenerated extends AbstractBackspaceHandlerTest
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/editor/backspaceHandler"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("rawStringDelete.kt")
public void testRawStringDelete() throws Exception {
runTest("idea/testData/editor/backspaceHandler/rawStringDelete.kt");
}
@TestMetadata("rawStringInCloseQuote.kt")
public void testRawStringInCloseQuote() throws Exception {
runTest("idea/testData/editor/backspaceHandler/rawStringInCloseQuote.kt");
}
@TestMetadata("rawStringInOpenQuote.kt")
public void testRawStringInOpenQuote() throws Exception {
runTest("idea/testData/editor/backspaceHandler/rawStringInOpenQuote.kt");
}
@TestMetadata("typeArguments.kt")
public void testTypeArguments() throws Exception {
runTest("idea/testData/editor/backspaceHandler/typeArguments.kt");