void () { assertEquals("foo \\s\n", PsiLiteralUtil.escapeTextBlockCharacters("foo \\n")); // escapes after 'bar' should be escaped since it's the last line in a text block assertEquals("foo \\s\nbar \\s", PsiLiteralUtil.escapeTextBlockCharacters("foo \\nbar ")); assertEquals("", PsiLiteralUtil.escapeTextBlockCharacters("")); // last in line quote should be escaped assertEquals("\\\"", PsiLiteralUtil.escapeTextBlockCharacters("\"")); assertEquals("\"\\\"", PsiLiteralUtil.escapeTextBlockCharacters("\"\"")); // all escaped quotes should be unescaped assertEquals("\"\\\"", PsiLiteralUtil.escapeTextBlockCharacters("\\\"\"")); // every third quote should be escaped assertEquals("\"\"\\\"\"\"\\\"\"\\\"", PsiLiteralUtil.escapeTextBlockCharacters("\"\"\"\"\"\"\"\"")); // all sequences except new line should stay as is assertEquals("\\t\n", PsiLiteralUtil.escapeTextBlockCharacters("\\t\\n")); }