Search in sources :

Example 31 with Operand

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

the class ExpressionTest method testListWithSingleElement.

@Test
public void testListWithSingleElement() throws Exception {
    Expression.compileExpressions = true;
    Operand o = Expression.evaluate("{'a'}", testDoc);
    List<Object> res = (List<Object>) o.value;
    assertEquals(1, res.size());
}
Also used : Operand(com.dexels.navajo.document.Operand) List(java.util.List) Test(org.junit.Test)

Example 32 with Operand

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

the class ExpressionTest method testExpressionWithDocSpecWithinSelectionWithoutCompiled.

// Re-enable if I backport this to non-compiled expressions.
@Test
@Ignore
public void testExpressionWithDocSpecWithinSelectionWithoutCompiled() throws Exception {
    Expression.compileExpressions = false;
    Operand o = Expression.evaluate("[custom|name]", testDoc, null, topMessage, testSelection, null);
    assertEquals("option1", o.value);
}
Also used : Operand(com.dexels.navajo.document.Operand) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 33 with Operand

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

the class ExpressionTest method testNonAscii.

@Test
public void testNonAscii() throws Exception {
    ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
    Operand o = ee.evaluate("'àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž'+'àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž'", null, null, null);
    assertEquals("àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżžàáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž", 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 34 with Operand

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

the class ExpressionTest method testEmptyTMLParam.

@Test
public void testEmptyTMLParam() throws Exception {
    Expression.compileExpressions = true;
    ImmutableMessage outer = ImmutableFactory.empty().with("outerint", 1, "integer");
    Operand o = Expression.evaluateImmutable("[@]", null, Optional.empty(), Optional.of(outer));
    ImmutableMessage s = o.immutableMessageValue();
    assertEquals(outer, s);
}
Also used : Operand(com.dexels.navajo.document.Operand) ImmutableMessage(com.dexels.immutable.api.ImmutableMessage) Test(org.junit.Test)

Example 35 with Operand

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

the class ExpressionTest method testExpressionWithDocSpecWithinSelection.

@Test
public void testExpressionWithDocSpecWithinSelection() throws Exception {
    Expression.compileExpressions = true;
    Operand o = Expression.evaluate("[custom|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