UAST: override getFunctionalInterfaceType + test
This commit is contained in:
committed by
Nikolay Krasko
parent
8eddb10870
commit
92c23aa0ed
@@ -80,6 +80,27 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun testSAM() {
|
||||
doTest("SAM") { _, file ->
|
||||
assertNull(file.findElementByText<ULambdaExpression>("{ /* Not SAM */ }").functionalInterfaceType)
|
||||
|
||||
assertEquals("java.lang.Runnable",
|
||||
file.findElementByText<ULambdaExpression>("{/* Variable */}").functionalInterfaceType?.canonicalText)
|
||||
|
||||
assertEquals("java.lang.Runnable",
|
||||
file.findElementByText<ULambdaExpression>("{/* Assignment */}").functionalInterfaceType?.canonicalText)
|
||||
|
||||
assertEquals("java.lang.Runnable",
|
||||
file.findElementByText<ULambdaExpression>("{/* Type Cast */}").functionalInterfaceType?.canonicalText)
|
||||
|
||||
assertEquals("java.lang.Runnable",
|
||||
file.findElementByText<ULambdaExpression>("{/* Argument */}").functionalInterfaceType?.canonicalText)
|
||||
|
||||
assertEquals("java.lang.Runnable",
|
||||
file.findElementByText<ULambdaExpression>("{/* Return */}").functionalInterfaceType?.canonicalText)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun testParameterPropertyWithAnnotation() {
|
||||
doTest("ParameterPropertyWithAnnotation") { _, file ->
|
||||
val test1 = file.classes.find { it.name == "Test1" }!!
|
||||
|
||||
Reference in New Issue
Block a user