Search in sources :

Example 11 with GoStringLiteral

use of com.goide.psi.GoStringLiteral in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoStringLiteralEscaperTest method testDecodeLongUnicodeCharString.

public void testDecodeLongUnicodeCharString() {
    PlatformTestUtil.withEncoding(CharsetToolkit.UTF8, () -> {
        GoStringLiteral expr = createStringFromText("\\U00008a9e");
        assertNotNull(expr);
        String a = decodeRange(expr, TextRange.create(1, 11));
        assertEquals("語", a);
    });
}
Also used : GoStringLiteral(com.goide.psi.GoStringLiteral)

Example 12 with GoStringLiteral

use of com.goide.psi.GoStringLiteral in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoStringLiteralEscaperTest method testEscaperDecodeString.

public void testEscaperDecodeString() {
    GoStringLiteral expr = createStringFromText("\\nfoo");
    assertNotNull(expr);
    assertEquals("fo", decodeRange(expr, TextRange.create(3, 5)));
    assertEquals("\n", decodeRange(expr, TextRange.create(1, 3)));
}
Also used : GoStringLiteral(com.goide.psi.GoStringLiteral)

Example 13 with GoStringLiteral

use of com.goide.psi.GoStringLiteral in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoStringLiteralEscaperTest method testDecodeOctalCharString.

public void testDecodeOctalCharString() {
    GoStringLiteral expr = createStringFromText("\\011");
    assertNotNull(expr);
    String a = decodeRange(expr, TextRange.create(1, 5));
    assertEquals("\t", a);
}
Also used : GoStringLiteral(com.goide.psi.GoStringLiteral)

Example 14 with GoStringLiteral

use of com.goide.psi.GoStringLiteral in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoStringLiteralEscaperTest method testEscaperDecodeRawString.

public void testEscaperDecodeRawString() {
    GoStringLiteral expr = createRawStringFromText("\nfoo");
    assertNotNull(expr);
    assertEquals("fo", decodeRange(expr, TextRange.create(2, 4)));
    assertEquals("\n", decodeRange(expr, TextRange.create(1, 2)));
}
Also used : GoStringLiteral(com.goide.psi.GoStringLiteral)

Example 15 with GoStringLiteral

use of com.goide.psi.GoStringLiteral in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoStringLiteralEscaperTest method testDecodeEscapedVerticalTabString.

public void testDecodeEscapedVerticalTabString() {
    GoStringLiteral expr = createStringFromText("\\v");
    assertNotNull(expr);
    String a = decodeRange(expr, TextRange.create(1, 3));
    assertEquals("\013", a);
}
Also used : GoStringLiteral(com.goide.psi.GoStringLiteral)

Aggregations

GoStringLiteral (com.goide.psi.GoStringLiteral)16 TextRange (com.intellij.openapi.util.TextRange)5 GoConditionalExpr (com.goide.psi.GoConditionalExpr)1 PsiElement (com.intellij.psi.PsiElement)1