Eval4j: add ignore annotations for tests

This commit is contained in:
Natalia Ukhorskaya
2014-06-20 18:16:18 +04:00
parent fab770a346
commit c847d180a7
3 changed files with 44 additions and 9 deletions
@@ -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";
}
@IgnoreInReflectionTests
String testInvokeSpecialForSuperCall() {
return super.superCall();
}
@IgnoreInReflectionTests
static String testInvokeSpecial() {
TestData td = new TestData();
return td.invokeSpecialPrivateFun("");
+18 -9
View File
@@ -36,16 +36,25 @@ fun suite(): TestSuite = buildTestSuite {
object : TestCase(getTestName(methodNode.name)) {
override fun runTest() {
val value = interpreterLoop(
methodNode,
initFrame(
ownerClass.getInternalName(),
methodNode
),
REFLECTION_EVAL
)
if (!isIgnored(methodNode)) {
val value = interpreterLoop(
methodNode,
initFrame(
ownerClass.getInternalName(),
methodNode
),
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
}
}
}