Skip to content

Commit

Permalink
Fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Potriasaeva committed Jul 27, 2023
1 parent 6b43be9 commit 78288e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun PsiFile.findMethodUsages(methodName: String): List<String> =
ApplicationManager.getApplication().runReadAction<List<String>> {
val callExpression = extractElementsOfTypes(KtCallExpression::class.java)
callExpression.filter { it.text == methodName }.mapNotNull {
it.parentsOfType(KtNamedFunction::class.java).first().name
it.parentsOfType(KtNamedFunction::class.java).firstOrNull()?.name
}.toList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,28 @@ class BaseIjTestClassTests : BaseIjTestClass() {
return squaredX + 10
}
fun method(message: String) {
println(message)
}
fun method(message: String) {
println(message)
}
fun method1(y: Int) {
val actions = "Some actions"
if (y > 5) {
method("y is greater than 5")
} else {
method("y is less than 5")
}
}
fun method1(y: Int) {
val actions = "Some actions"
if (y > 5) {
method("y is greater than 5")
} else {
method("y is less than 5")
}
}
fun method2() {
method("Content")
println("Content")
}
}
""".trimIndent()
myFixture.configureByText("Task.kt", example)
var methodName = "method(\"Content\")"
var methodsList = listOf("innerFunction")
var methodsList = listOf("innerFunction", "method2")
assert(methodsList.equals(findMethodUsages(methodName))) {
"Method $methodName should be called in methods: $methodsList"
}
Expand All @@ -173,6 +178,11 @@ class BaseIjTestClassTests : BaseIjTestClass() {
assert(methodsList.equals(findMethodUsages(methodName))) {
"Method $methodName should be called in methods: $methodsList"
}
methodName = "method(content)"
methodsList = listOf()
assert(methodsList.equals(findMethodUsages(methodName))) {
"Method $methodName should not be called"
}
}

fun testHasProperty() {
Expand Down

0 comments on commit 78288e0

Please sign in to comment.