Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
00f1eb55
Commit
00f1eb55
authored
6 years ago
by
Alexey Kudravtsev
Browse files
Options
Download
Email Patches
Plain Diff
more diagnostics for leaking documents before test
parent
8a696b35
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
+7
-4
...tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
with
7 additions
and
4 deletions
+7
-4
platform/platform-tests/testSrc/com/intellij/usages/impl/UsageViewTest.java
+
7
-
4
View file @
00f1eb55
...
...
@@ -19,6 +19,7 @@ import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers;
import
com.intellij.openapi.progress.ProgressIndicator
;
import
com.intellij.openapi.progress.ProgressManager
;
import
com.intellij.openapi.progress.Task
;
import
com.intellij.openapi.util.Condition
;
import
com.intellij.openapi.util.Disposer
;
import
com.intellij.openapi.util.text.StringUtil
;
import
com.intellij.psi.PsiDocumentManager
;
...
...
@@ -44,12 +45,14 @@ import java.util.Set;
public
class
UsageViewTest
extends
LightPlatformCodeInsightFixtureTestCase
{
public
void
testUsageViewDoesNotHoldPsiFilesOrDocuments
()
{
boolean
[]
foundLeaksBeforeTest
=
new
boolean
[
1
];
LeakHunter
.
checkLeak
(
ApplicationManager
.
getApplication
(),
PsiFileImpl
.
class
,
file
->
{
if
(
!
file
.
isPhysical
())
return
false
;
System
.
err
.
println
(
"DON'T BLAME ME, IT'S NOT MY FAULT! SOME SNEAKY TEST BEFORE ME HAS LEAKED PsiFiles!"
);
Condition
<
Object
>
isReallyLeak
=
file
->
{
if
(
file
instanceof
PsiFile
&&
!((
PsiFile
)
file
)
.
isPhysical
())
return
false
;
System
.
err
.
println
(
"DON'T BLAME ME, IT'S NOT MY FAULT! SOME SNEAKY TEST BEFORE ME HAS LEAKED PsiFiles
/Documents
!"
);
foundLeaksBeforeTest
[
0
]
=
true
;
return
true
;
});
};
LeakHunter
.
checkLeak
(
ApplicationManager
.
getApplication
(),
PsiFileImpl
.
class
,
isReallyLeak
);
LeakHunter
.
checkLeak
(
ApplicationManager
.
getApplication
(),
Document
.
class
,
isReallyLeak
);
if
(
foundLeaksBeforeTest
[
0
])
{
fail
(
"Can't start the test: leaking PsiFiles found"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help