IDEA-74544 Copy-Paste a string literal with '\n' character inserts actual line-feed instead of '\n'

All elements from the copied text are correctly parsed now and only string literal content is un-escaped if necessary now
This commit is contained in:
Denis.Zhdanov
2011-10-06 13:12:38 +04:00
parent 7d0b2f2c7f
commit 5fdda8663e
2 changed files with 82 additions and 81 deletions
@@ -1,25 +0,0 @@
package com.intellij.codeInsight.editorActions;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Denis Zhdanov
* @since 10/4/11 1:28 PM
*/
public class StringLiteralCopyPasteProcessorTest {
@Test
public void escapePastedStringLiteral() {
doEscapePastedStringLiteralTest("identity", "identity");
doEscapePastedStringLiteralTest("\"complete \n literal\"", "\"complete \\n literal\"");
doEscapePastedStringLiteralTest("\"incomplete \n literal", "\"incomplete \n literal");
doEscapePastedStringLiteralTest("partial \"string \n literal\"", "partial \"string \\n literal\"");
}
private static void doEscapePastedStringLiteralTest(@NotNull String initial, @NotNull String expected) {
assertEquals(expected, StringLiteralCopyPasteProcessor.escapePastedLiteral(initial));
}
}