Eval4j: add ignore annotations for tests
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.eval4j.test;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface IgnoreInReflectionTests {
|
||||||
|
}
|
||||||
@@ -697,10 +697,12 @@ class TestData extends BaseTestData {
|
|||||||
return "Derived";
|
return "Derived";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IgnoreInReflectionTests
|
||||||
String testInvokeSpecialForSuperCall() {
|
String testInvokeSpecialForSuperCall() {
|
||||||
return super.superCall();
|
return super.superCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IgnoreInReflectionTests
|
||||||
static String testInvokeSpecial() {
|
static String testInvokeSpecial() {
|
||||||
TestData td = new TestData();
|
TestData td = new TestData();
|
||||||
return td.invokeSpecialPrivateFun("");
|
return td.invokeSpecialPrivateFun("");
|
||||||
|
|||||||
@@ -36,16 +36,25 @@ fun suite(): TestSuite = buildTestSuite {
|
|||||||
object : TestCase(getTestName(methodNode.name)) {
|
object : TestCase(getTestName(methodNode.name)) {
|
||||||
|
|
||||||
override fun runTest() {
|
override fun runTest() {
|
||||||
val value = interpreterLoop(
|
if (!isIgnored(methodNode)) {
|
||||||
methodNode,
|
val value = interpreterLoop(
|
||||||
initFrame(
|
methodNode,
|
||||||
ownerClass.getInternalName(),
|
initFrame(
|
||||||
methodNode
|
ownerClass.getInternalName(),
|
||||||
),
|
methodNode
|
||||||
REFLECTION_EVAL
|
),
|
||||||
)
|
REFLECTION_EVAL
|
||||||
|
)
|
||||||
|
assertEquals(expected, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assertEquals(expected, value)
|
private fun isIgnored(methodNode: MethodNode): Boolean {
|
||||||
|
return methodNode.visibleAnnotations?.any {
|
||||||
|
val annotationDesc = it.desc
|
||||||
|
annotationDesc != null &&
|
||||||
|
Type.getType(annotationDesc) == Type.getType(javaClass<IgnoreInReflectionTests>())
|
||||||
|
} ?: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user