Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.AppendExpression


        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.APPEND_EXPRESSION: {
        AppendExpression appendExpression = (AppendExpression) theEObject;
        T result = caseAppendExpression(appendExpression);
        if(result == null)
          result = caseBinaryExpression(appendExpression);
        if(result == null)
          result = caseExpression(appendExpression);
View Full Code Here


   * - $x += expr
   */
  @Test
  public void test_Validate_AppendExpression_Ok() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertOK();
  }
View Full Code Here

  }

  @Test
  public void test_Serialize_AppendExpression() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    b.setValue(true);
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    String s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_Append, s);
  }
View Full Code Here

   * - a += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    pp.getStatements().add(ae);

    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    AtExpression at = pf.createAtExpression();
    at.setLeftExpr(v);
    at.getParameters().add(createNameOrReference("a"));

    ae.setLeftExpr(at);
    ae.setRightExpr(b);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__NOT_APPENDABLE);

    ae.setLeftExpr(createNameOrReference("a"));
    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__NOT_APPENDABLE);

  }
View Full Code Here

   * - $0 += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk_Decimal() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$0");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__ASSIGNMENT_DECIMAL_VAR);

  }
View Full Code Here

   * - $a::b += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk_Scope() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$a::b");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__ASSIGNMENT_OTHER_NAMESPACE);

  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.pp.AppendExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.