/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.25 */ @Override protected void validateTestMethods(List<Throwable> errors) { TruffleTestInvoker.validateTestMethods(getTestClass(), errors); }
/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.27 */ @Override public Statement apply(Statement stmt, Description description) { return TruffleTestInvoker.withTruffleContext(this, stmt); }
static void validateTestMethods(TestClass testClass, List<Throwable> errors) { List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Test.class); for (FrameworkMethod method : methods) { method.validatePublicVoid(false, errors); Annotation[][] parameterAnnotations = method.getMethod().getParameterAnnotations(); Class<?>[] parameterTypes = method.getMethod().getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { if (parameterTypes[i] == CallTarget.class) { TruffleRunner.Inject testRootNode = findRootNodeAnnotation(parameterAnnotations[i]); if (testRootNode == null) { errors.add(new Exception("CallTarget parameter of test method " + method.getName() + " should have @Inject annotation")); } else { if (getNodeConstructor(testRootNode, testClass) == null) { errors.add(new Exception("Node " + testRootNode.value().getName() + " should have a default constructor or a constructor taking a " + testClass.getName())); } } } else { errors.add(new Exception("Invalid parameter type " + parameterTypes[i].getSimpleName() + " on test method " + method.getName())); } } } } }
@Override protected Statement methodInvoker(FrameworkMethod method, Object test) { Statement ret = truffleTestInvoker.createStatement(getName(), method, test); if (ret == null) { ret = super.methodInvoker(method, test); } return ret; }
static TruffleTestInvoker<?, ?> create() { TVMCI.Test<?, ?> testTvmci = Truffle.getRuntime().getCapability(TVMCI.Test.class); return new TruffleTestInvoker<>(testTvmci); }
static void validateTestMethods(TestClass testClass, List<Throwable> errors) { List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Test.class); for (FrameworkMethod method : methods) { method.validatePublicVoid(false, errors); Annotation[][] parameterAnnotations = method.getMethod().getParameterAnnotations(); Class<?>[] parameterTypes = method.getMethod().getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { if (parameterTypes[i] == CallTarget.class) { TruffleRunner.Inject testRootNode = findRootNodeAnnotation(parameterAnnotations[i]); if (testRootNode == null) { errors.add(new Exception("CallTarget parameter of test method " + method.getName() + " should have @Inject annotation")); } else { if (getNodeConstructor(testRootNode, testClass) == null) { errors.add(new Exception("Node " + testRootNode.value().getName() + " should have a default constructor or a constructor taking a " + testClass.getName())); } } } else { errors.add(new Exception("Invalid parameter type " + parameterTypes[i].getSimpleName() + " on test method " + method.getName())); } } } } }
/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.25 */ @Override protected Statement methodInvoker(FrameworkMethod method, Object test) { Statement ret = truffleTestInvoker.createStatement(testName(method), method, test); if (ret == null) { ret = super.methodInvoker(method, test); } return ret; }
static TruffleTestInvoker<?> create() { TVMCI.Test<?> testTvmci = Truffle.getRuntime().getCapability(TVMCI.Test.class); return new TruffleTestInvoker<>(testTvmci); }
/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.25 */ @Override protected void validateTestMethods(List<Throwable> errors) { TruffleTestInvoker.validateTestMethods(getTestClass(), errors); }
@Override protected Statement methodInvoker(FrameworkMethod method, Object test) { Statement ret = truffleTestInvoker.createStatement(getTestClass().getJavaClass().getSimpleName() + "#" + testName(method), method, test); if (ret == null) { ret = super.methodInvoker(method, test); } return ret; }
/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.27 */ @Override public Statement apply(Statement stmt, Description description) { return TruffleTestInvoker.withTruffleContext(this, stmt); }
@Override protected void validateTestMethods(List<Throwable> errors) { TruffleTestInvoker.validateTestMethods(getTestClass(), errors); }
/** * Internal method used by the JUnit framework. Do not call directly. * * @since 0.25 */ @Override protected Statement methodInvoker(FrameworkMethod method, Object test) { Statement ret = truffleTestInvoker.createStatement(getTestClass().getJavaClass().getSimpleName() + "#" + testName(method), method, test); if (ret == null) { ret = super.methodInvoker(method, test); } return ret; }
@Override protected void validateTestMethods(List<Throwable> errors) { TruffleTestInvoker.validateTestMethods(getTestClass(), errors); }