Enable mute for KotlinCompletionTestCase

This commit is contained in:
Nikolay Krasko
2020-02-25 16:35:20 +03:00
parent 66e2f95dba
commit c22272bbca
3 changed files with 28 additions and 0 deletions
@@ -717,6 +717,18 @@ public class KotlinTestUtils {
MuteWithDatabaseKt.runTest(testCase, test);
}
public static void runTestWithThrowable(@NotNull TestCase testCase, @NotNull RunnableWithThrowable test) {
MuteWithDatabaseKt.runTest(testCase, () -> {
try {
test.run();
}
catch (Throwable throwable) {
throw new IllegalStateException(throwable);
}
return null;
});
}
// In this test runner version the `testDataFile` parameter is annotated by `TestDataFile`.
// So only file paths passed to this parameter will be used in navigation actions, like "Navigate to testdata" and "Related Symbol..."
public static void runTest(DoTest test, TargetBackend targetBackend, @TestDataFile String testDataFile) throws Exception {
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.test;
public interface RunnableWithThrowable {
void run() throws Throwable;
}
@@ -25,4 +25,10 @@ abstract public class KotlinCompletionTestCase extends CompletionTestCase {
VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory());
super.tearDown();
}
@Override
protected void runTest() throws Throwable {
//noinspection Convert2MethodRef
KotlinTestUtils.runTestWithThrowable(this, () -> super.runTest());
}
}