use of org.elasticsearch.painless.Location in project elasticsearch by elastic.
the class NodeToStringTests method testPSubField.
public void testPSubField() {
Location l = new Location(getTestName(), 0);
Struct s = Definition.getType(Boolean.class.getSimpleName()).struct;
Field f = s.staticMembers.get("TRUE");
PSubField node = new PSubField(l, f);
node.prefix = new EStatic(l, "Boolean");
assertEquals("(PSubField (EStatic Boolean) TRUE)", node.toString());
assertEquals("(PSubNullSafeCallInvoke (PSubField (EStatic Boolean) TRUE))", new PSubNullSafeCallInvoke(l, node).toString());
}
use of org.elasticsearch.painless.Location in project elasticsearch by elastic.
the class NodeToStringTests method testPSubDefField.
public void testPSubDefField() {
Location l = new Location(getTestName(), 0);
PSubDefField node = new PSubDefField(l, "ok");
node.prefix = new EVariable(l, "a");
assertEquals("(PSubDefField (EVariable a) ok)", node.toString());
assertEquals("(PSubNullSafeCallInvoke (PSubDefField (EVariable a) ok))", new PSubNullSafeCallInvoke(l, node).toString());
}
use of org.elasticsearch.painless.Location in project elasticsearch by elastic.
the class NodeToStringTests method testSSubEachIterable.
public void testSSubEachIterable() {
Location l = new Location(getTestName(), 0);
Variable v = new Variable(l, "test", Definition.INT_TYPE, 5, false);
AExpression e = new EListInit(l, Arrays.asList(new EConstant(l, 1), new EConstant(l, 2), new EConstant(l, 3)));
SBlock b = new SBlock(l, singletonList(new SReturn(l, new EConstant(l, 5))));
SSubEachIterable node = new SSubEachIterable(l, v, e, b);
assertEquals("(SSubEachIterable int test (EListInit (EConstant Integer 1) (EConstant Integer 2) (EConstant Integer 3)) (SBlock " + "(SReturn (EConstant Integer 5))))", node.toString());
}
use of org.elasticsearch.painless.Location in project elasticsearch by elastic.
the class NodeToStringTests method testPSubDefArray.
public void testPSubDefArray() {
Location l = new Location(getTestName(), 0);
PSubDefArray node = new PSubDefArray(l, new EConstant(l, 1));
node.prefix = new EVariable(l, "a");
assertEquals("(PSubDefArray (EVariable a) (EConstant Integer 1))", node.toString());
}
use of org.elasticsearch.painless.Location in project elasticsearch by elastic.
the class NodeToStringTests method testEConstant.
public void testEConstant() {
assertEquals("(EConstant String '121')", new EConstant(new Location(getTestName(), 0), "121").toString());
assertEquals("(EConstant String '92 ')", new EConstant(new Location(getTestName(), 0), "92 ").toString());
assertEquals("(EConstant Integer 1237)", new EConstant(new Location(getTestName(), 1), 1237).toString());
assertEquals("(EConstant Boolean true)", new EConstant(new Location(getTestName(), 2), true).toString());
}
Aggregations