Few improvements in test infrastructure:
* add the way to specify another compatible target for target backend. It's used to generate a test for X_IR backend even when in a test data is explicitly written a target: "// TARGET_BACKEND: X". * Add the ability to run tests "ignored" with the "IGNORE_BACKEND" directive as regular tests, i.e. w/o catching exceptions. * Print stack trace of caught exception inside tests "ignored" with the "IGNORE_BACKEND" directive.
This commit is contained in:
+14
-15
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2018 JetBrains s.r.o. 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.generators.tests.generator;
|
||||
@@ -79,18 +68,28 @@ public class SimpleTestMethodModel implements TestMethodModel {
|
||||
String filePath = KotlinTestUtils.getFilePath(file) + (file.isDirectory() ? "/" : "");
|
||||
p.println("String fileName = KotlinTestUtils.navigationMetadata(\"", filePath, "\");");
|
||||
|
||||
if (isIgnoredTarget(targetBackend, file)) {
|
||||
boolean ignoredTarget = isIgnoredTarget(targetBackend, file);
|
||||
|
||||
if (ignoredTarget) {
|
||||
p.println("if (KotlinTestUtils.RUN_IGNORED_TESTS_AS_REGULAR) {");
|
||||
p.pushIndent();
|
||||
p.println(doTestMethodName, "(fileName);");
|
||||
p.println("return;");
|
||||
p.popIndent();
|
||||
p.println("}");
|
||||
|
||||
p.println("try {");
|
||||
p.pushIndent();
|
||||
}
|
||||
|
||||
p.println(doTestMethodName, "(fileName);");
|
||||
|
||||
if (isIgnoredTarget(targetBackend, file)) {
|
||||
if (ignoredTarget) {
|
||||
p.popIndent();
|
||||
p.println("}");
|
||||
p.println("catch (Throwable ignore) {");
|
||||
p.pushIndent();
|
||||
p.println("ignore.printStackTrace();");
|
||||
p.println("return;");
|
||||
p.popIndent();
|
||||
p.println("}");
|
||||
|
||||
Reference in New Issue
Block a user