-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added indent handling for the case when condition or loop inside scop…
…e function ### What's done: * added findIndentBeforeNode() function * reworked test for loops * added test for conditions
- Loading branch information
Showing
6 changed files
with
141 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...les/src/test/resources/test/paragraph3/braces/IfElseBracesInsideScopeFunctionsExpected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package test.paragraph3.braces | ||
|
||
fun foo1() { | ||
str.apply { | ||
if (x > 0) { | ||
foo() | ||
} else { | ||
bar() | ||
} | ||
} | ||
} | ||
|
||
fun foo2() { | ||
str.let { if (x > 0) { foo() } | ||
else { | ||
bar() | ||
} | ||
} | ||
} | ||
|
||
fun foo3() { | ||
str.run { | ||
while (x > 0) { | ||
if (x > 0) { | ||
foo() | ||
} else { | ||
bar() | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun foo4() { | ||
str.with { while (x > 0) { | ||
if (x > 0) { | ||
foo() | ||
} else { bar() } | ||
} | ||
} | ||
} | ||
|
||
fun foo5() { | ||
str.also { | ||
while (x > 0) { if (x > 0) { | ||
foo() | ||
} else { | ||
bar() | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...t-rules/src/test/resources/test/paragraph3/braces/IfElseBracesInsideScopeFunctionsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package test.paragraph3.braces | ||
|
||
fun foo1() { | ||
str.apply { | ||
if (x > 0) foo() | ||
else bar() | ||
} | ||
} | ||
|
||
fun foo2() { | ||
str.let { if (x > 0) { foo() } | ||
else bar() | ||
} | ||
} | ||
|
||
fun foo3() { | ||
str.run { | ||
while (x > 0) { | ||
if (x > 0) foo() | ||
else bar() | ||
} | ||
} | ||
} | ||
|
||
fun foo4() { | ||
str.with { while (x > 0) { | ||
if (x > 0) foo() | ||
else { bar() } | ||
} | ||
} | ||
} | ||
|
||
fun foo5() { | ||
str.also { | ||
while (x > 0) { if (x > 0) foo() | ||
else bar() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters