use of org.eclipse.core.internal.expressions.EqualsExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testEqualsExpressionNotEqual.
public void testEqualsExpressionNotEqual() throws Exception {
EqualsExpression expression1 = new EqualsExpression("+");
EqualsExpression expression2 = new EqualsExpression("!");
assertTrue("These equals expressions should not be equal", !expression1.equals(expression2));
}
use of org.eclipse.core.internal.expressions.EqualsExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testEqualsExpressionHashCode.
public void testEqualsExpressionHashCode() throws Exception {
EqualsExpression expression1 = new EqualsExpression("*");
EqualsExpression expression2 = new EqualsExpression("*");
assertEquals("Equal expressions should have the same hash code", expression1.hashCode(), expression2.hashCode());
}
use of org.eclipse.core.internal.expressions.EqualsExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testWithExpressionNoVariable.
public void testWithExpressionNoVariable() throws Exception {
WithExpression expr = new WithExpression("variable");
expr.add(new EqualsExpression(new Object()));
EvaluationContext context = new EvaluationContext(null, new Object());
try {
expr.evaluate(context);
fail("Should throw exceptoin");
} catch (CoreException e) {
// this is success
}
}
use of org.eclipse.core.internal.expressions.EqualsExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testEqualsExpression.
public void testEqualsExpression() throws Exception {
// $NON-NLS-1$
EqualsExpression exp = new EqualsExpression("name");
// $NON-NLS-1$
EvaluationContext context = new EvaluationContext(null, "name");
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
exp = new EqualsExpression(Boolean.TRUE);
context = new EvaluationContext(null, Boolean.TRUE);
assertTrue(EvaluationResult.TRUE == exp.evaluate(context));
// $NON-NLS-1$
exp = new EqualsExpression("name");
context = new EvaluationContext(null, Boolean.TRUE);
assertTrue(EvaluationResult.FALSE == exp.evaluate(context));
}
use of org.eclipse.core.internal.expressions.EqualsExpression in project eclipse.platform.runtime by eclipse.
the class ExpressionTests method testWithExpressionUndefinedVariable.
public void testWithExpressionUndefinedVariable() throws Exception {
WithExpression expr = new WithExpression("variable");
expr.add(new EqualsExpression(new Object()));
EvaluationContext context = new EvaluationContext(null, new Object());
context.addVariable("variable", IEvaluationContext.UNDEFINED_VARIABLE);
assertEquals(EvaluationResult.FALSE, expr.evaluate(context));
}
Aggregations