Minor: reformat LambdaReturnValueHints.kt
This commit is contained in:
@@ -13,77 +13,84 @@ class LambdaReturnValueHintsTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|
||||||
fun check(text: String) {
|
fun check(text: String) {
|
||||||
myFixture.configureByText("A.kt", text)
|
myFixture.configureByText("A.kt", text.trimIndent())
|
||||||
myFixture.testInlays()
|
myFixture.testInlays()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testSimple() {
|
fun testSimple() {
|
||||||
check(
|
check(
|
||||||
"""val x = run {
|
"""
|
||||||
|
val x = run {
|
||||||
println("foo")
|
println("foo")
|
||||||
<hint text="^run" />1
|
<hint text="^run" />1
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testQualified() {
|
fun testQualified() {
|
||||||
check(
|
check(
|
||||||
"""val x = run {
|
"""
|
||||||
|
val x = run {
|
||||||
var s = "abc"
|
var s = "abc"
|
||||||
<hint text="^run" />s.length
|
<hint text="^run" />s.length
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testIf() {
|
fun testIf() {
|
||||||
check(
|
check(
|
||||||
"""val x = run {
|
"""
|
||||||
|
val x = run {
|
||||||
if (true) {
|
if (true) {
|
||||||
<hint text="^run" />1
|
<hint text="^run" />1
|
||||||
} else {
|
} else {
|
||||||
<hint text="^run" />0
|
<hint text="^run" />0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testWhen() {
|
fun testWhen() {
|
||||||
check(
|
check(
|
||||||
"""val x = run {
|
"""
|
||||||
|
val x = run {
|
||||||
when (true) {
|
when (true) {
|
||||||
true -> <hint text="^run" />1
|
true -> <hint text="^run" />1
|
||||||
false -><hint text="^run" />0
|
false -><hint text="^run" />0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testNoHintForSingleExpression() {
|
fun testNoHintForSingleExpression() {
|
||||||
check(
|
check(
|
||||||
"""val x = run {
|
"""
|
||||||
|
val x = run {
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testLabel() {
|
fun testLabel() {
|
||||||
check(
|
check(
|
||||||
"""val x = run foo@{
|
"""
|
||||||
|
val x = run foo@{
|
||||||
println("foo")
|
println("foo")
|
||||||
<hint text="^foo" />1
|
<hint text="^foo" />1
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testNested() {
|
fun testNested() {
|
||||||
check(
|
check(
|
||||||
"""val x = run hello@{
|
"""
|
||||||
|
val x = run hello@{
|
||||||
if (true) {
|
if (true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,39 +100,40 @@ class LambdaReturnValueHintsTest : KotlinLightCodeInsightFixtureTestCase() {
|
|||||||
false -> <hint text="^run" />0
|
false -> <hint text="^run" />0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"""
|
}
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testElvisOperator() {
|
fun testElvisOperator() {
|
||||||
check(
|
check(
|
||||||
"""
|
"""
|
||||||
fun foo() {
|
fun foo() {
|
||||||
run {
|
run {
|
||||||
val length: Int? = null
|
val length: Int? = null
|
||||||
<hint text="^run" />length ?: 0
|
<hint text="^run" />length ?: 0
|
||||||
}
|
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
}
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testPostfixPrefixExpressions() {
|
fun testPostfixPrefixExpressions() {
|
||||||
check(
|
check(
|
||||||
"""
|
"""
|
||||||
fun bar() {
|
fun bar() {
|
||||||
var test = 0
|
var test = 0
|
||||||
run {
|
run {
|
||||||
test
|
test
|
||||||
<hint text="^run"/>test++
|
<hint text="^run"/>test++
|
||||||
}
|
|
||||||
|
|
||||||
run {
|
|
||||||
test
|
|
||||||
<hint text="^run"/>++test
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
|
||||||
|
run {
|
||||||
|
test
|
||||||
|
<hint text="^run"/>++test
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user