use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionWithAdapterManagerIfEmptyTrue.
public void testIterateExpressionWithAdapterManagerIfEmptyTrue() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or", "true");
final List<String> input = new ArrayList<>();
CollectionWrapper wrapper = new CollectionWrapper();
wrapper.collection = input;
EvaluationContext context = new EvaluationContext(null, wrapper);
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 testIterateExpressionNotEqual.
public void testIterateExpressionNotEqual() throws Exception {
IterateExpression expression1 = new IterateExpression("or");
expression1.add(new InstanceofExpression(// $NON-NLS-1$
"org.eclipse.core.internal.expressions.tests.Adapter"));
IterateExpression expression2 = new IterateExpression("and");
expression2.add(new InstanceofExpression(// $NON-NLS-1$
"org.eclipse.core.internal.expressions.tests.Adapter"));
assertTrue("These iterate expressions should not be equal", !expression1.equals(expression2));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionOrFalse.
public void testIterateExpressionOrFalse() throws Exception {
final List<Object> result = new ArrayList<>();
Expression myExpression = new Expression() {
@Override
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
result.add(context.getDefaultVariable());
return EvaluationResult.FALSE;
}
};
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or");
exp.add(myExpression);
List<String> input = new ArrayList<>();
// $NON-NLS-1$
input.add("one");
// $NON-NLS-1$
input.add("two");
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
assertTrue(result.equals(input));
}
use of org.eclipse.core.internal.expressions.IterateExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testIterateExpressionAnd_IfEmptyFalse.
public void testIterateExpressionAnd_IfEmptyFalse() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("and", "false");
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 testIterateExpressionOr_IfEmptyFalse.
public void testIterateExpressionOr_IfEmptyFalse() throws Exception {
// $NON-NLS-1$
IterateExpression exp = new IterateExpression("or", "false");
List<?> input = new ArrayList<>();
EvaluationContext context = new EvaluationContext(null, input);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
Aggregations