-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import com.intellij.psi.PsiClass | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.util.PsiTreeUtil | ||
|
||
fun countPsiClasses(psiFile: PsiFile): Int { | ||
return PsiTreeUtil.findChildrenOfType(psiFile, PsiClass::class.java).toList().size | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import com.intellij.testFramework.fixtures.BasePlatformTestCase | ||
|
||
class Test : BasePlatformTestCase() { | ||
fun testSolution() { | ||
val file = myFixture.configureByText("MyClass.kt", """ | ||
class MyFirstClass { | ||
} | ||
class MySecondClass { | ||
} | ||
""".trimIndent()) | ||
|
||
val psiClassesCount = countPsiClasses(file) | ||
assertEquals(2, psiClassesCount) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
custom_name: Course section | ||
content: | ||
- courseLesson | ||
- courseFrameworkLesson |