use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionEmptyOr.
public void testIterateExpressionEmptyOr() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or");
List<?> input = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testSubType.
public void testSubType() throws Exception {
EvaluationContext context = new EvaluationContext(null, IEvaluationContext.UNDEFINED_VARIABLE);
ArrayList<AbstractCollection<?>> list = new ArrayList<>();
HashSet<?> o1 = new HashSet<>();
EvaluationContext c1 = new EvaluationContext(null, o1);
list.add(o1);
ArrayList<?> o2 = new ArrayList<>();
EvaluationContext c2 = new EvaluationContext(null, o2);
list.add(o2);
LinkedList<?> o3 = new LinkedList<>();
EvaluationContext c3 = new EvaluationContext(null, o3);
list.add(o3);
context.addVariable("selection", list);
WithExpression with = new WithExpression("selection");
IterateExpression iterate = new IterateExpression("and", "false");
with.add(iterate);
InstanceofExpression iCollection = new InstanceofExpression("java.util.Collection");
iterate.add(iCollection);
InstanceofExpression iSet = new InstanceofExpression("java.util.Set");
InstanceofExpression iList = new InstanceofExpression("java.util.List");
assertEquals(EvaluationResult.TRUE, iSet.evaluate(c1));
assertEquals(EvaluationResult.FALSE, iList.evaluate(c1));
assertEquals(EvaluationResult.FALSE, iSet.evaluate(c2));
assertEquals(EvaluationResult.TRUE, iList.evaluate(c2));
assertEquals(EvaluationResult.FALSE, iSet.evaluate(c3));
assertEquals(EvaluationResult.TRUE, iList.evaluate(c3));
assertEquals(EvaluationResult.TRUE, with.evaluate(context));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionOr_IfEmptyTrue.
public void testIterateExpressionOr_IfEmptyTrue() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or", "true");
List<?> input = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionEmptyAnd.
public void testIterateExpressionEmptyAnd() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("and");
List<?> input = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionWithAdapterManagerEmptyOr.
public void testIterateExpressionWithAdapterManagerEmptyOr() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or");
final List<String> input = new ArrayList<>();
CollectionWrapper wrapper = new CollectionWrapper();
wrapper.collection = input;
EvaluationContext context = new EvaluationContext(null, wrapper);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
Aggregations