File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ class Demo {
2
+ val foo = X .bar(" lorem" )
3
+ }
Original file line number Diff line number Diff line change 1
1
package org.jetbrains.uast.test.kotlin
2
2
3
+ import org.jetbrains.kotlin.psi.KtLiteralStringTemplateEntry
3
4
import org.jetbrains.uast.UAnnotation
4
5
import org.jetbrains.uast.UFile
6
+ import org.jetbrains.uast.ULiteralExpression
7
+ import org.jetbrains.uast.psi.PsiElementBacked
5
8
import org.jetbrains.uast.test.env.findElementByText
9
+ import org.jetbrains.uast.toUElement
10
+ import org.junit.Assert
6
11
import org.junit.Test
7
12
8
13
@@ -17,5 +22,15 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
17
22
assertEquals(annotation.findAttributeValue(" to" )?.expression?.evaluate(), 0 )
18
23
}
19
24
}
20
- }
21
25
26
+ @Test fun testConvertStringTemplate () {
27
+ doTest(" StringTemplateInClass" ) { name, file ->
28
+ val literalExpression = file.findElementByText<ULiteralExpression >(" lorem" )
29
+ val psi = (literalExpression as PsiElementBacked ).psi!!
30
+ Assert .assertTrue(psi is KtLiteralStringTemplateEntry )
31
+ val literalExpressionAgain = psi.toUElement()
32
+ Assert .assertTrue(literalExpressionAgain is ULiteralExpression )
33
+
34
+ }
35
+ }
36
+ }
You can’t perform that action at this time.
0 commit comments