UAST: Complex test data moved to separate file (KT-20990)

This commit is contained in:
Nicolay Mitropolsky
2017-11-06 13:16:19 +01:00
committed by xiexed
parent 9730d50e10
commit fab8187574
7 changed files with 109 additions and 48 deletions
-10
View File
@@ -3,13 +3,3 @@ val bar = "ipsum"
val baz = "dolor"
val foobarbaz = "$foo $bar $baz"
val case4 = "a ${"literal"} z"
fun simpleForTemplate(i: Int = 0) = "$i"
fun foo() {
println("$baz")
val template1 = "${simpleForTemplate()}"
val template2 = ".${simpleForTemplate()}"
}
-30
View File
@@ -17,37 +17,7 @@ UFile (package = )
USimpleNameReferenceExpression (identifier = bar)
ULiteralExpression (value = " ")
USimpleNameReferenceExpression (identifier = baz)
UField (name = case4)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
ULiteralExpression (value = "a ")
ULiteralExpression (value = "literal")
ULiteralExpression (value = " z")
UAnnotationMethod (name = getFoo)
UAnnotationMethod (name = getBar)
UAnnotationMethod (name = getBaz)
UAnnotationMethod (name = getFoobarbaz)
UAnnotationMethod (name = getCase4)
UAnnotationMethod (name = simpleForTemplate)
UParameter (name = i)
UAnnotation (fqName = null)
ULiteralExpression (value = 0)
USimpleNameReferenceExpression (identifier = i)
UAnnotationMethod (name = foo)
UBlockExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (println))
USimpleNameReferenceExpression (identifier = println)
USimpleNameReferenceExpression (identifier = baz)
UDeclarationsExpression
ULocalVariable (name = template1)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (simpleForTemplate))
USimpleNameReferenceExpression (identifier = simpleForTemplate)
UDeclarationsExpression
ULocalVariable (name = template2)
UPolyadicExpression (operator = +)
ULiteralExpression (value = ".")
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (simpleForTemplate))
USimpleNameReferenceExpression (identifier = simpleForTemplate)
@@ -3,16 +3,8 @@ public final class StringTemplateKt {
private static final var bar: java.lang.String = "ipsum"
private static final var baz: java.lang.String = "dolor"
private static final var foobarbaz: java.lang.String = foo + " " + bar + " " + baz
private static final var case4: java.lang.String = "a " + "literal" + " z"
public static final fun getFoo() : java.lang.String = UastEmptyExpression
public static final fun getBar() : java.lang.String = UastEmptyExpression
public static final fun getBaz() : java.lang.String = UastEmptyExpression
public static final fun getFoobarbaz() : java.lang.String = UastEmptyExpression
public static final fun getCase4() : java.lang.String = UastEmptyExpression
public static final fun simpleForTemplate(i: int) : java.lang.String = i
public static final fun foo() : void {
println(baz)
var template1: java.lang.String = simpleForTemplate()
var template2: java.lang.String = "." + simpleForTemplate()
}
}
+17
View File
@@ -0,0 +1,17 @@
val muchRecur = "${"${"${"abc"}"}"}"
val case4 = "a ${"literal"} z"
val case5 = "a ${"literal"} ${"literal"} z"
val literalInLiteral = "a ${"literal$case4"} z"
val literalInLiteral2 = "a ${"literal$case4".repeat(4)} z"
fun simpleForTemplate(i: Int = 0) = "$i"
fun foo() {
println("$baz")
val template1 = "${simpleForTemplate()}"
val template2 = ".${simpleForTemplate()}"
}
@@ -0,0 +1,68 @@
UFile (package = )
UClass (name = StringTemplateComplexKt)
UField (name = muchRecur)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
ULiteralExpression (value = "abc")
UField (name = case4)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
ULiteralExpression (value = "a ")
ULiteralExpression (value = "literal")
ULiteralExpression (value = " z")
UField (name = case5)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
ULiteralExpression (value = "a ")
ULiteralExpression (value = "literal")
ULiteralExpression (value = " ")
ULiteralExpression (value = "literal")
ULiteralExpression (value = " z")
UField (name = literalInLiteral)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
ULiteralExpression (value = "a ")
UPolyadicExpression (operator = +)
ULiteralExpression (value = "literal")
USimpleNameReferenceExpression (identifier = case4)
ULiteralExpression (value = " z")
UField (name = literalInLiteral2)
UAnnotation (fqName = org.jetbrains.annotations.NotNull)
UPolyadicExpression (operator = +)
ULiteralExpression (value = "a ")
UQualifiedReferenceExpression
UPolyadicExpression (operator = +)
ULiteralExpression (value = "literal")
USimpleNameReferenceExpression (identifier = case4)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (repeat))
USimpleNameReferenceExpression (identifier = repeat)
ULiteralExpression (value = 4)
ULiteralExpression (value = " z")
UAnnotationMethod (name = getMuchRecur)
UAnnotationMethod (name = getCase4)
UAnnotationMethod (name = getCase5)
UAnnotationMethod (name = getLiteralInLiteral)
UAnnotationMethod (name = getLiteralInLiteral2)
UAnnotationMethod (name = simpleForTemplate)
UParameter (name = i)
UAnnotation (fqName = null)
ULiteralExpression (value = 0)
USimpleNameReferenceExpression (identifier = i)
UAnnotationMethod (name = foo)
UBlockExpression
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
UIdentifier (Identifier (println))
USimpleNameReferenceExpression (identifier = println)
USimpleNameReferenceExpression (identifier = baz)
UDeclarationsExpression
ULocalVariable (name = template1)
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (simpleForTemplate))
USimpleNameReferenceExpression (identifier = simpleForTemplate)
UDeclarationsExpression
ULocalVariable (name = template2)
UPolyadicExpression (operator = +)
ULiteralExpression (value = ".")
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
UIdentifier (Identifier (simpleForTemplate))
USimpleNameReferenceExpression (identifier = simpleForTemplate)
@@ -0,0 +1,18 @@
public final class StringTemplateComplexKt {
private static final var muchRecur: java.lang.String = "abc"
private static final var case4: java.lang.String = "a " + "literal" + " z"
private static final var case5: java.lang.String = "a " + "literal" + " " + "literal" + " z"
private static final var literalInLiteral: java.lang.String = "a " + "literal" + case4 + " z"
private static final var literalInLiteral2: java.lang.String = "a " + "literal" + case4.repeat(4) + " z"
public static final fun getMuchRecur() : java.lang.String = UastEmptyExpression
public static final fun getCase4() : java.lang.String = UastEmptyExpression
public static final fun getCase5() : java.lang.String = UastEmptyExpression
public static final fun getLiteralInLiteral() : java.lang.String = UastEmptyExpression
public static final fun getLiteralInLiteral2() : java.lang.String = UastEmptyExpression
public static final fun simpleForTemplate(i: int) : java.lang.String = i
public static final fun foo() : void {
println(baz)
var template1: java.lang.String = simpleForTemplate()
var template2: java.lang.String = "." + simpleForTemplate()
}
}
@@ -1,5 +1,9 @@
package org.jetbrains.uast.test.kotlin
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtVisitor
import org.junit.Test
class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
@@ -25,6 +29,8 @@ class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() {
@Test fun testStringTemplate() = doTest("StringTemplate")
@Test fun testStringTemplateComplex() = doTest("StringTemplateComplex")
@Test fun testQualifiedConstructorCall() = doTest("QualifiedConstructorCall")
@Test fun testPropertyDelegate() = doTest("PropertyDelegate") { testName, file -> check(testName, file, false) }