mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[test] Properly check for test framework in test diff
GitOrigin-RevId: ebae1e49fc5fd108c3db8549833fa83240918cb6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
96f3947157
commit
5263b8ca9e
@@ -18,11 +18,12 @@ abstract class JvmTestDiffProvider : TestDiffProvider {
|
||||
var enclosingMethod: UMethod? = null
|
||||
val lineParser = ExceptionLineParserFactory.getInstance().create(ExceptionInfoCache(project, GlobalSearchScope.allScope(project)))
|
||||
stackTrace.lineSequence().forEach { line ->
|
||||
lineParser.execute(line, line.length) ?: return@findExpected null
|
||||
lineParser.execute(line, line.length) ?: return@forEach
|
||||
if (isTestFramework(lineParser.uClass)) return@forEach
|
||||
val file = lineParser.file ?: return@findExpected null
|
||||
val diffProvider = TestDiffProvider.TEST_DIFF_PROVIDER_LANGUAGE_EXTENSION.forLanguage(file.language).asSafely<JvmTestDiffProvider>()
|
||||
if (diffProvider == null) return@findExpected null
|
||||
if (diffProvider.isCompiled(file)) return@forEach
|
||||
if (diffProvider.isCompiled(file)) return@findExpected null
|
||||
val virtualFile = file.virtualFile ?: return@findExpected null
|
||||
val document = FileDocumentManager.getInstance().getDocument(virtualFile) ?: return@findExpected null
|
||||
val lineNumber = lineParser.info.lineNumber
|
||||
@@ -38,6 +39,10 @@ abstract class JvmTestDiffProvider : TestDiffProvider {
|
||||
return null
|
||||
}
|
||||
|
||||
private fun isTestFramework(clazz: UClass?): Boolean {
|
||||
return clazz?.qualifiedName?.startsWith("org.junit") == true || clazz?.qualifiedName?.startsWith("org.testng") == true
|
||||
}
|
||||
|
||||
abstract fun isCompiled(file: PsiFile): Boolean
|
||||
|
||||
abstract fun failedCall(file: PsiFile, startOffset: Int, endOffset: Int, method: UMethod?): PsiElement?
|
||||
|
||||
Reference in New Issue
Block a user