use of spoon.support.reflect.eval.InlinePartialEvaluator in project spoon by INRIA.
the class EvalTest method testVisitorPartialEvaluatorScanner.
@Test
public void testVisitorPartialEvaluatorScanner() throws Exception {
Launcher launcher = new Launcher();
launcher.addInputResource("src/test/java/spoon/test/eval/Foo.java");
launcher.buildModel();
VisitorPartialEvaluator eval = new VisitorPartialEvaluator();
CtType<?> foo = launcher.getFactory().Type().get((Class<?>) Foo.class);
foo.accept(new InlinePartialEvaluator(eval));
assertEquals("false", foo.getElements(new TypeFilter<>(CtLocalVariable.class)).get(0).getDefaultExpression().toString());
// the if has been removed
assertEquals(0, foo.getElements(new TypeFilter<>(CtIf.class)).size());
}
Aggregations