Search in sources :

Example 26 with Operand

use of com.dexels.navajo.document.Operand in project navajo by Dexels.

the class TestCompiledStringExpression method testAddTwoStrings.

// ADD
@Test
public void testAddTwoStrings() {
    Operand result = Expression.evaluate("'bla' + 'bli'", null, null, null);
    assertEquals("blabli", result.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) Test(org.junit.Test)

Example 27 with Operand

use of com.dexels.navajo.document.Operand in project navajo by Dexels.

the class TestCompiledStringExpression method testAddDoubleAndString.

@Test
public void testAddDoubleAndString() {
    Operand result = Expression.evaluate("15.0 + 'bla'", null, null, null);
    assertEquals("15.0bla", result.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) Test(org.junit.Test)

Example 28 with Operand

use of com.dexels.navajo.document.Operand in project navajo by Dexels.

the class ExpressionTest method testExpressionNewlineOutside.

@Test
public void testExpressionNewlineOutside() throws Exception {
    ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
    Operand o = ee.evaluate("1\n+\n1", null, null, null);
    assertEquals(2, o.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) ExpressionEvaluator(com.dexels.navajo.document.ExpressionEvaluator) CachedExpressionEvaluator(com.dexels.navajo.parser.compiled.api.CachedExpressionEvaluator) Test(org.junit.Test)

Example 29 with Operand

use of com.dexels.navajo.document.Operand in project navajo by Dexels.

the class ExpressionTest method testExpressionNewline.

@Test
public void testExpressionNewline() throws Exception {
    ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
    Operand o = ee.evaluate("'aap\nnoot'", null, null, null);
    assertEquals("aap\nnoot", o.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) ExpressionEvaluator(com.dexels.navajo.document.ExpressionEvaluator) CachedExpressionEvaluator(com.dexels.navajo.parser.compiled.api.CachedExpressionEvaluator) Test(org.junit.Test)

Example 30 with Operand

use of com.dexels.navajo.document.Operand in project navajo by Dexels.

the class ExpressionTest method testExpressionWithinSelectionWithoutCompiled.

@Test
public void testExpressionWithinSelectionWithoutCompiled() throws Exception {
    Expression.compileExpressions = false;
    Operand o = Expression.evaluate("[name]", testDoc, null, topMessage, testSelection, null);
    assertEquals("option1", o.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) Test(org.junit.Test)

Aggregations

Operand (com.dexels.navajo.document.Operand)95 Test (org.junit.Test)57 Message (com.dexels.navajo.document.Message)22 ImmutableMessage (com.dexels.immutable.api.ImmutableMessage)20 Navajo (com.dexels.navajo.document.Navajo)20 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)15 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)14 ArrayList (java.util.ArrayList)12 Selection (com.dexels.navajo.document.Selection)11 Property (com.dexels.navajo.document.Property)10 FunctionInterface (com.dexels.navajo.expression.api.FunctionInterface)10 Access (com.dexels.navajo.script.api.Access)10 MappableTreeNode (com.dexels.navajo.script.api.MappableTreeNode)10 NavajoException (com.dexels.navajo.document.NavajoException)9 TipiLink (com.dexels.navajo.expression.api.TipiLink)9 Optional (java.util.Optional)9 FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)8 GiveLongTestFunction (com.dexels.navajo.expression.compiled.GiveLongTestFunction)6 SystemException (com.dexels.navajo.script.api.SystemException)6 List (java.util.List)6