// Path: org.chromium.gnsupport.core/src/org/chromium/gnsupport/core/ast/GnAssignmentExpression.java
// public class GnAssignmentExpression extends GnBinaryExpression {
//   public GnAssignmentExpression(Statement left, int kind, Expression right) {
//     super(left, right, kind);
//   }
// }
// 
// Path: org.chromium.gnsupport.core/src/org/chromium/gnsupport/core/ast/GnMethodDeclaration.java
// public class GnMethodDeclaration extends MethodDeclaration {
//   private Type type;
//   private SimpleReference originalRef;
// 
//   public static enum Type {
//     NORMAL, TEMPLATE, TARGET, TEMPLATE_CALL
//   }
// 
//   public GnMethodDeclaration(String name, int nameStart, int nameEnd, int declStart, int declEnd) {
//     super(name, nameStart, nameEnd, declStart, declEnd);
//     type = Type.NORMAL;
//     SimpleReference ref = super.getRef();
//     originalRef = new SimpleReference(ref.start(), ref.end(), ref.getName());
//   }
// 
//   public SimpleReference getOriginalRef() {
//     return originalRef;
//   }
// 
//   public ASTNode getFirstArgument() {
//     if (getArguments().isEmpty()) {
//       return null;
//     }
//     return ((GnArgument) getArguments().get(0)).getActualNode();
//   }
// 
//   @Override
//   public String getName() {
//     return getRef().toString();
//   }
// 
// 
//   public Type getType() {
//     return type;
//   }
// 
//   public void setType(Type type) {
//     this.type = type;
//     ASTNode newRef;
//     switch (type) {
//       case TEMPLATE:
//       case TARGET:
//         ASTNode arg = getFirstArgument();
//         newRef = arg == null ? originalRef : arg;
//         break;
//       case NORMAL:
//       case TEMPLATE_CALL:
//       default:
//         newRef = originalRef;
//         break;
//     }
//     this.setName(newRef.toString());
//     this.setNameStart(newRef.start());
//     this.setNameEnd(newRef.end());
//   }
// 
// }


import org.eclipse.dltk.ast.ASTListNode;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.expressions.BooleanLiteral;
import org.eclipse.dltk.ast.expressions.NumericLiteral;
import org.eclipse.dltk.ast.expressions.StringLiteral;
import org.eclipse.dltk.ast.references.SimpleReference;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.chromium.gnsupport.core.ast.GnAssignmentExpression;
import org.chromium.gnsupport.core.ast.GnMethodDeclaration;
/*
 * Copyright (c) 2014, The Chromium Authors
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holder nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.chromium.gnsupport.internal.core.parser;




public class SyntaxParserTest extends AbstractParserTest {

  private static final int EOF_POSITION = -1;

  @Test
  public void testCommentNoNewline() throws Exception {
    ASTListNode root = parseClean("# Test");
    assertEquals(0, root.getChilds().size());
  }

  @Test
  public void testComment() throws Exception {
    ASTListNode root = parseClean("# Test\n");
    assertEquals(0, root.getChilds().size());
  }

  @Test
  public void testAssignmentNumber() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = 1");
    assertNode(assignment, GnAssignmentExpression.class, 0, 7);
    assertNode(((GnAssignmentExpression) assignment).getRight(), NumericLiteral.class, 6, 7);
  }

  @Test
  public void testAssignmentString() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = \"1\"");
    assertNode(assignment, GnAssignmentExpression.class, 0, 9);
    assertNode(((GnAssignmentExpression) assignment).getRight(), StringLiteral.class, 6, 9);
  }

  @Test
  public void testAssignmentBoolean() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = true");
// Path: org.chromium.gnsupport.core/src/org/chromium/gnsupport/core/ast/GnAssignmentExpression.java
// public class GnAssignmentExpression extends GnBinaryExpression {
//   public GnAssignmentExpression(Statement left, int kind, Expression right) {
//     super(left, right, kind);
//   }
// }
// 
// Path: org.chromium.gnsupport.core/src/org/chromium/gnsupport/core/ast/GnMethodDeclaration.java
// public class GnMethodDeclaration extends MethodDeclaration {
//   private Type type;
//   private SimpleReference originalRef;
// 
//   public static enum Type {
//     NORMAL, TEMPLATE, TARGET, TEMPLATE_CALL
//   }
// 
//   public GnMethodDeclaration(String name, int nameStart, int nameEnd, int declStart, int declEnd) {
//     super(name, nameStart, nameEnd, declStart, declEnd);
//     type = Type.NORMAL;
//     SimpleReference ref = super.getRef();
//     originalRef = new SimpleReference(ref.start(), ref.end(), ref.getName());
//   }
// 
//   public SimpleReference getOriginalRef() {
//     return originalRef;
//   }
// 
//   public ASTNode getFirstArgument() {
//     if (getArguments().isEmpty()) {
//       return null;
//     }
//     return ((GnArgument) getArguments().get(0)).getActualNode();
//   }
// 
//   @Override
//   public String getName() {
//     return getRef().toString();
//   }
// 
// 
//   public Type getType() {
//     return type;
//   }
// 
//   public void setType(Type type) {
//     this.type = type;
//     ASTNode newRef;
//     switch (type) {
//       case TEMPLATE:
//       case TARGET:
//         ASTNode arg = getFirstArgument();
//         newRef = arg == null ? originalRef : arg;
//         break;
//       case NORMAL:
//       case TEMPLATE_CALL:
//       default:
//         newRef = originalRef;
//         break;
//     }
//     this.setName(newRef.toString());
//     this.setNameStart(newRef.start());
//     this.setNameEnd(newRef.end());
//   }
// 
// }


// Path: org.chromium.gnsupport.core.test/test/org/chromium/gnsupport/internal/core/parser/SyntaxParserTest.java
import org.eclipse.dltk.ast.ASTListNode;
import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.expressions.BooleanLiteral;
import org.eclipse.dltk.ast.expressions.NumericLiteral;
import org.eclipse.dltk.ast.expressions.StringLiteral;
import org.eclipse.dltk.ast.references.SimpleReference;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import org.chromium.gnsupport.core.ast.GnAssignmentExpression;
import org.chromium.gnsupport.core.ast.GnMethodDeclaration;

/*
 * Copyright (c) 2014, The Chromium Authors
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holder nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.chromium.gnsupport.internal.core.parser;




public class SyntaxParserTest extends AbstractParserTest {

  private static final int EOF_POSITION = -1;

  @Test
  public void testCommentNoNewline() throws Exception {
    ASTListNode root = parseClean("# Test");
    assertEquals(0, root.getChilds().size());
  }

  @Test
  public void testComment() throws Exception {
    ASTListNode root = parseClean("# Test\n");
    assertEquals(0, root.getChilds().size());
  }

  @Test
  public void testAssignmentNumber() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = 1");
    assertNode(assignment, GnAssignmentExpression.class, 0, 7);
    assertNode(((GnAssignmentExpression) assignment).getRight(), NumericLiteral.class, 6, 7);
  }

  @Test
  public void testAssignmentString() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = \"1\"");
    assertNode(assignment, GnAssignmentExpression.class, 0, 9);
    assertNode(((GnAssignmentExpression) assignment).getRight(), StringLiteral.class, 6, 9);
  }

  @Test
  public void testAssignmentBoolean() throws Exception {
    ASTNode assignment = parseCleanSingleNode("foo = true");
    assertNode(assignment, GnAssignmentExpression.class, 0, 10);