You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2015/10/11 20:40:11 UTC

[1/3] incubator-groovy git commit: refactor LineColumnCheckTestSuite to parametrized test

Repository: incubator-groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 33a73b7a8 -> d496c069a


refactor LineColumnCheckTestSuite to parametrized test


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/bfbca350
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/bfbca350
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/bfbca350

Branch: refs/heads/GROOVY_2_4_X
Commit: bfbca3502b3bd543df9724eaeb5ec3704b8ec680
Parents: 9436c55
Author: pascalschumacher <pa...@gmx.net>
Authored: Sun Oct 11 20:00:12 2015 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Oct 11 20:35:50 2015 +0200

----------------------------------------------------------------------
 .../groovy/ast/LineColumnCheckTest.groovy       | 470 ++++++++++++++++++-
 .../groovy/ast/LineColumnCheckTestSuite.java    |  98 ----
 .../codehaus/groovy/ast/LineColumnChecker.java  | 458 ------------------
 3 files changed, 465 insertions(+), 561 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/bfbca350/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy b/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
index f78f355..23cb4d7 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
@@ -18,12 +18,472 @@
  */
 package org.codehaus.groovy.ast
 
-import junit.textui.TestRunner
+import org.codehaus.groovy.ast.expr.ArgumentListExpression
+import org.codehaus.groovy.ast.expr.ArrayExpression
+import org.codehaus.groovy.ast.expr.AttributeExpression
+import org.codehaus.groovy.ast.expr.BinaryExpression
+import org.codehaus.groovy.ast.expr.BitwiseNegationExpression
+import org.codehaus.groovy.ast.expr.BooleanExpression
+import org.codehaus.groovy.ast.expr.CastExpression
+import org.codehaus.groovy.ast.expr.ClassExpression
+import org.codehaus.groovy.ast.expr.ClosureExpression
+import org.codehaus.groovy.ast.expr.ClosureListExpression
+import org.codehaus.groovy.ast.expr.ConstantExpression
+import org.codehaus.groovy.ast.expr.ConstructorCallExpression
+import org.codehaus.groovy.ast.expr.DeclarationExpression
+import org.codehaus.groovy.ast.expr.ElvisOperatorExpression
+import org.codehaus.groovy.ast.expr.FieldExpression
+import org.codehaus.groovy.ast.expr.GStringExpression
+import org.codehaus.groovy.ast.expr.ListExpression
+import org.codehaus.groovy.ast.expr.MapEntryExpression
+import org.codehaus.groovy.ast.expr.MapExpression
+import org.codehaus.groovy.ast.expr.MethodCallExpression
+import org.codehaus.groovy.ast.expr.MethodPointerExpression
+import org.codehaus.groovy.ast.expr.NotExpression
+import org.codehaus.groovy.ast.expr.PostfixExpression
+import org.codehaus.groovy.ast.expr.PrefixExpression
+import org.codehaus.groovy.ast.expr.PropertyExpression
+import org.codehaus.groovy.ast.expr.RangeExpression
+import org.codehaus.groovy.ast.expr.SpreadExpression
+import org.codehaus.groovy.ast.expr.SpreadMapExpression
+import org.codehaus.groovy.ast.expr.StaticMethodCallExpression
+import org.codehaus.groovy.ast.expr.TernaryExpression
+import org.codehaus.groovy.ast.expr.TupleExpression
+import org.codehaus.groovy.ast.expr.UnaryMinusExpression
+import org.codehaus.groovy.ast.expr.UnaryPlusExpression
+import org.codehaus.groovy.ast.expr.VariableExpression
+import org.codehaus.groovy.ast.stmt.Statement
+import org.codehaus.groovy.control.SourceUnit
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
 
-class LineColumnCheckTest extends GroovyTestCase {
-    // TODO simplify by having suite directly included rather than via TestRunner
-    // or better yet make whole suite a single Parameterized test
+/*
+ * Tests the LineColumn information in file specified in TEST_FILE_PATH
+ * 
+ * The file in the specified path should look like:
+ * 
+ * ###<testname>:::
+ * <source code from which the AST will be built>
+ * :::<expected AST output>
+ * 
+ * The section above can be repeated for every new TestCase
+ * 
+ * The AST output from the visitor is quite big. Also for small source code snippets. Therefore
+ * it is possible to only specify the nodes that you want to check and separate them with a semicolon.
+ * A semicolon is also needed when you begin with a new line.
+ * Example: 
+ * [TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)];
+ * [CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
+ * [CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)];
+ * [BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)]
+ * 
+ * [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]
+ * 
+ * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf</a>
+ *
+ */
+
+@RunWith(Parameterized.class)
+class LineColumnCheckTest extends ASTTest {
+
+    static final String TEST_FILE_PATH = "./src/test/org/codehaus/groovy/ast/LineColumnCheck.txt";
+
+    private LineCheckVisitor visitor
+    private String name
+    private String source
+    private String[] expected
+
+    @Parameterized.Parameters(name = "Test {0}: Source: {1} Expected: {2}")
+    static Iterable<Object[]> data() {
+        String content = new File(TEST_FILE_PATH).text
+        String[] tests = content.split("###")
+        tests = tests.drop(1) // remove apache header
+        List testdata = []
+        for (String test : tests) {
+            testdata << (test.split(":::").collect { it.trim() } as Object[])
+        }
+        return testdata
+    }
+
+    LineColumnCheckTest(String name, String source, String expected) {
+        this.name = name
+        this.source = source
+        this.expected = expected.split(";")
+    }
+
+    @Before
+    void setUp() {
+        visitor = new LineCheckVisitor()
+    }
+
+    @Test
     void testLineColumnInfo() {
-        assert TestRunner.run(LineColumnCheckTestSuite.suite()).wasSuccessful()
+        visitor.visitModuleNode(getAST(source));
+        String was = visitor.getASTString();
+        //comment out next line to view the output of the visitor
+        //System.out.println(name + ": " + was);
+        for (String anExpected : expected) {
+            assertTrue("'" + anExpected + "' not found in '" + was + "'", was.indexOf(anExpected.trim()) != -1);
+        }
+    }
+}
+
+/**
+ *
+ * Visitor to write for each visited node a string like:
+ * [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]
+ *
+ */
+class LineCheckVisitor extends ClassCodeVisitorSupport {
+
+    private StringBuffer astString = new StringBuffer();
+
+    public String getASTString() {
+        return astString.toString();
+    }
+
+    protected void visitStatement(Statement statement) {
+        visitNode(statement);
+    }
+
+    protected void visitType(ClassNode node) {
+        visitNode(node);
+        visitGenerics(node);
+    }
+
+    protected void visitTypes(ClassNode[] classNodes) {
+        if (classNodes != null) {
+            for (ClassNode classNode : classNodes) {
+                visitType(classNode);
+            }
+        }
+    }
+
+    protected void visitGenerics(ClassNode node) {
+        if (node.isUsingGenerics()) {
+            GenericsType[] generics = node.getGenericsTypes();
+            if(generics == null) return;
+            for (GenericsType genericType : generics) {
+                visitNode(genericType);
+                visitType(genericType.getType());
+                if (genericType.getLowerBound() != null) {
+                    visitType(genericType.getLowerBound());
+                }
+                visitTypes(genericType.getUpperBounds());
+            }
+        }
+    }
+
+    protected void visitNodes(ASTNode[] nodes) {
+        if (nodes != null) {
+            for (ASTNode node : nodes) {
+                visitNode(node);
+            }
+        }
+    }
+
+    protected void visitNode(ASTNode node) {
+        String nodeName = node.getClass().getName();
+        //get classname without package
+        nodeName = nodeName.substring(nodeName.lastIndexOf(".") + 1,nodeName.length());
+        astString.append("[");
+        astString.append(nodeName);
+        astString.append(",(");
+        astString.append(node.getLineNumber());
+        astString.append(":");
+        astString.append(node.getColumnNumber());
+        astString.append("),(");
+        astString.append(node.getLastLineNumber());
+        astString.append(":");
+        astString.append(node.getLastColumnNumber());
+        astString.append(")]");
+        //String of each node looks like: [AssertStatement,(1:1),(1:20)]
+    }
+
+    public SourceUnit getSourceUnit() {
+        return null;
+    }
+
+    public void visitModuleNode(ModuleNode moduleNode) {
+
+        //visit imports like import java.io.File and import java.io.File as MyFile
+        for (ImportNode importNode : moduleNode.getImports()) {
+            visitNode(importNode.getType());
+        }
+
+        //visit static imports like import java.lang.Math.*
+        for (ImportNode importNode : moduleNode.getStaticStarImports().values()) {
+            visitNode(importNode.getType());
+        }
+
+        //visit static imports like import java.lang.Math.cos
+        for (ImportNode importNode : moduleNode.getStaticImports().values()) {
+            visitNode(importNode.getType());
+        }
+
+        for (ClassNode classNode : moduleNode.getClasses()) {
+            if (!classNode.isScript()) {
+                visitClass(classNode);
+            } else {
+                for (MethodNode method : moduleNode.getMethods()) {
+                    visitMethod(method);
+                }
+            }
+        }
+        //visit Statements that are not inside a class
+        if (!moduleNode.getStatementBlock().isEmpty()) {
+            visitBlockStatement(moduleNode.getStatementBlock());
+        }
+    }
+
+    public void visitClass(ClassNode node) {
+        visitType(node);
+        visitType(node.getUnresolvedSuperClass());
+        visitTypes(node.getInterfaces());
+        super.visitClass(node);
+    }
+
+    public void visitAnnotations(AnnotatedNode node) {
+        List<AnnotationNode> annotationMap = node.getAnnotations();
+        if (annotationMap.isEmpty()) return;
+        visitNode(node);
+        for (AnnotationNode annotationNode : annotationMap) {
+            visitNode(annotationNode);
+        }
+    }
+
+    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) {
+        visitAnnotations(node);
+        analyseMethodHead(node);
+        Statement code = node.getCode();
+
+        visitClassCodeContainer(code);
+    }
+
+    private void analyseMethodHead(MethodNode node) {
+        visitNode(node.getReturnType());
+        analyseParameters(node.getParameters());
+        visitNodes(node.getExceptions());
+    }
+
+    private void analyseParameters(Parameter[] parameters) {
+        for (Parameter parameter : parameters) {
+            visitType(parameter.getOriginType());
+            if (parameter.hasInitialExpression()) {
+                parameter.getInitialExpression().visit(this);
+            }
+        }
+    }
+
+    public void visitConstructor(ConstructorNode node) {
+        visitNode(node);
+        super.visitConstructor(node);
+    }
+
+    public void visitMethod(MethodNode node) {
+        visitNode(node);
+        super.visitMethod(node);
+    }
+
+    public void visitField(FieldNode node) {
+        // Do not visit fields which are manually added due to optimization
+        if (!node.getName().startsWith('$')) {
+            visitType(node.getOriginType());
+            visitNode(node);
+            super.visitField(node);
+        }
+    }
+
+    public void visitProperty(PropertyNode node) {
+        // do nothing, also visited as FieldNode
+    }
+
+    /*
+     * Statements
+     *
+     * Statements not written here are visited in ClassCodeVisitorSupport and call there
+     * visitStatement(Statement statement) which is overridden in this class
+     */
+
+    /*
+     * Expressions
+     */
+    public void visitMethodCallExpression(MethodCallExpression call) {
+        visitNode(call);
+        super.visitMethodCallExpression(call);
+    }
+
+    public void visitStaticMethodCallExpression(StaticMethodCallExpression call) {
+        visitNode(call);
+        super.visitStaticMethodCallExpression(call);
+    }
+
+    public void visitConstructorCallExpression(ConstructorCallExpression call) {
+        visitNode(call);
+        visitType(call.getType());
+        super.visitConstructorCallExpression(call);
+    }
+
+    public void visitBinaryExpression(BinaryExpression expression) {
+        visitNode(expression);
+        super.visitBinaryExpression(expression);
+    }
+
+    public void visitTernaryExpression(TernaryExpression expression) {
+        visitNode(expression);
+        super.visitTernaryExpression(expression);
+    }
+
+    public void visitPostfixExpression(PostfixExpression expression) {
+        visitNode(expression);
+        super.visitPostfixExpression(expression);
+    }
+
+    public void visitPrefixExpression(PrefixExpression expression) {
+        visitNode(expression);
+        super.visitPrefixExpression(expression);
+    }
+
+    public void visitBooleanExpression(BooleanExpression expression) {
+        visitNode(expression);
+        super.visitBooleanExpression(expression);
+    }
+
+    public void visitNotExpression(NotExpression expression) {
+        visitNode(expression);
+        super.visitNotExpression(expression);
+    }
+
+    public void visitClosureExpression(ClosureExpression expression) {
+        visitNode(expression);
+        super.visitClosureExpression(expression);
+    }
+
+    public void visitTupleExpression(TupleExpression expression) {
+        visitNode(expression);
+        super.visitTupleExpression(expression);
+    }
+
+    public void visitListExpression(ListExpression expression) {
+        visitNode(expression);
+        super.visitListExpression(expression);
+    }
+
+    public void visitArrayExpression(ArrayExpression expression) {
+        visitNode(expression);
+        visitNode(expression.getElementType());
+        super.visitArrayExpression(expression);
+    }
+
+    public void visitMapExpression(MapExpression expression) {
+        visitNode(expression);
+        super.visitMapExpression(expression);
+    }
+
+    public void visitMapEntryExpression(MapEntryExpression expression) {
+        visitNode(expression);
+        super.visitMapEntryExpression(expression);
+    }
+
+    public void visitRangeExpression(RangeExpression expression) {
+        visitNode(expression);
+        super.visitRangeExpression(expression);
+    }
+
+    public void visitSpreadExpression(SpreadExpression expression) {
+        visitNode(expression);
+        super.visitSpreadExpression(expression);
+    }
+
+    public void visitSpreadMapExpression(SpreadMapExpression expression) {
+        visitNode(expression);
+        super.visitSpreadMapExpression(expression);
+    }
+
+    public void visitMethodPointerExpression(MethodPointerExpression expression) {
+        visitNode(expression);
+        super.visitMethodPointerExpression(expression);
+    }
+
+    public void visitBitwiseNegationExpression(
+            BitwiseNegationExpression expression) {
+        visitNode(expression);
+        super.visitBitwiseNegationExpression(expression);
+    }
+
+    public void visitCastExpression(CastExpression expression) {
+        visitNode(expression);
+        visitType(expression.getType());
+        super.visitCastExpression(expression);
+    }
+
+    public void visitConstantExpression(ConstantExpression expression) {
+        visitNode(expression);
+        super.visitConstantExpression(expression);
+    }
+
+    public void visitClassExpression(ClassExpression expression) {
+        visitNode(expression);
+        super.visitClassExpression(expression);
+    }
+
+    public void visitVariableExpression(VariableExpression expression) {
+        visitNode(expression);
+        super.visitVariableExpression(expression);
+    }
+
+    public void visitDeclarationExpression(DeclarationExpression expression) {
+        //visitNode(expression); is visited afterwards in BinaryExpression. Because
+        //super.visitDeclarationExpression calls visitBinaryExpression
+        visitType(expression.getLeftExpression().getType());
+        super.visitDeclarationExpression(expression);
+    }
+
+    public void visitPropertyExpression(PropertyExpression expression) {
+        visitNode(expression);
+        super.visitPropertyExpression(expression);
+    }
+
+    public void visitAttributeExpression(AttributeExpression expression) {
+        visitNode(expression);
+        super.visitAttributeExpression(expression);
+    }
+
+    public void visitFieldExpression(FieldExpression expression) {
+        visitNode(expression);
+        super.visitFieldExpression(expression);
+    }
+
+    public void visitGStringExpression(GStringExpression expression) {
+        visitNode(expression);
+        super.visitGStringExpression(expression);
+    }
+
+    public void visitArgumentlistExpression(ArgumentListExpression ale) {
+        //visitNode(ale); is visited afterwards in TupleExpression. Because
+        //super.visitArgumentlistExpression calls visitTupleExpression
+        super.visitArgumentlistExpression(ale);
+    }
+
+    public void visitShortTernaryExpression(ElvisOperatorExpression expression) {
+        visitNode(expression);
+        super.visitShortTernaryExpression(expression);
+    }
+
+    public void visitUnaryPlusExpression(UnaryPlusExpression expression) {
+        visitNode(expression);
+        super.visitUnaryPlusExpression(expression);
+    }
+
+    public void visitUnaryMinusExpression(UnaryMinusExpression expression) {
+        visitNode(expression);
+        super.visitUnaryMinusExpression(expression);
+    }
+
+    public void visitClosureListExpression(ClosureListExpression cle) {
+        visitNode(cle);
+        super.visitClosureListExpression(cle);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/bfbca350/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java b/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
deleted file mode 100644
index 3e3ec60..0000000
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.codehaus.groovy.ast;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-
-import junit.framework.TestSuite;
-
-/**
- * Tests the LineColumn information in file specified in TEST_FILE_PATH
- * 
- * The file in the specified path should look like:
- * 
- * ###<testname>:::
- * <source code from which the AST will be built>
- * :::<expected AST output>
- * 
- * The section above can be repeated for every new TestCase
- * 
- * The AST output from the visitor is quite big. Also for small source code snippets. Therefore
- * it is possible to only specify the nodes that you want to check and separate them with a semicolon.
- * A semicolon is also needed when you begin with a new line.
- * Bsp: 
- * [TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)];
- * [CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
- * [CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)];
- * [BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)]
- * 
- * [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]
- * 
- * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf</a>
- *
- */
-public class LineColumnCheckTestSuite extends TestSuite {
-
-    public static final String TEST_FILE_PATH = "./src/test/org/codehaus/groovy/ast/LineColumnCheck.txt";
-
-    public static TestSuite suite() {
-        TestSuite ts = new TestSuite("LineColumnCheckTestSuite");
-        String content;
-        try {
-            content = getContent(new FileReader(TEST_FILE_PATH));
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(e);
-        }
-        String[] tests = content.split("###");
-        String testName = "";
-        String source = "";
-        String expected;
-        for (String test : tests) {
-            String[] slicedTests = test.split(":::");
-            for (int ii = 0; ii < slicedTests.length; ii++) {
-                if (ii % 3 == 0) {
-                    testName = slicedTests[ii];
-                } else if (ii % 3 == 1) {
-                    source = slicedTests[ii].trim();
-                } else if (ii % 3 == 2) {
-                    expected = slicedTests[ii].trim();
-                    ts.addTest(new LineColumnChecker(testName, source, expected));
-                }
-            }
-        }
-        return ts;
-    }
-
-    private static String getContent(Reader reader) {
-        int character;
-        StringBuilder content = new StringBuilder();
-        try {
-            while ((character = reader.read()) != -1) {
-                content.append((char) character);
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return content.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/bfbca350/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnChecker.java b/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
deleted file mode 100644
index 3694c4b..0000000
--- a/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.codehaus.groovy.ast;
-
-import java.util.List;
-import org.codehaus.groovy.ast.expr.ArgumentListExpression;
-import org.codehaus.groovy.ast.expr.ArrayExpression;
-import org.codehaus.groovy.ast.expr.AttributeExpression;
-import org.codehaus.groovy.ast.expr.BinaryExpression;
-import org.codehaus.groovy.ast.expr.BitwiseNegationExpression;
-import org.codehaus.groovy.ast.expr.BooleanExpression;
-import org.codehaus.groovy.ast.expr.CastExpression;
-import org.codehaus.groovy.ast.expr.ClassExpression;
-import org.codehaus.groovy.ast.expr.ClosureExpression;
-import org.codehaus.groovy.ast.expr.ClosureListExpression;
-import org.codehaus.groovy.ast.expr.ConstantExpression;
-import org.codehaus.groovy.ast.expr.ConstructorCallExpression;
-import org.codehaus.groovy.ast.expr.DeclarationExpression;
-import org.codehaus.groovy.ast.expr.ElvisOperatorExpression;
-import org.codehaus.groovy.ast.expr.FieldExpression;
-import org.codehaus.groovy.ast.expr.GStringExpression;
-import org.codehaus.groovy.ast.expr.ListExpression;
-import org.codehaus.groovy.ast.expr.MapEntryExpression;
-import org.codehaus.groovy.ast.expr.MapExpression;
-import org.codehaus.groovy.ast.expr.MethodCallExpression;
-import org.codehaus.groovy.ast.expr.MethodPointerExpression;
-import org.codehaus.groovy.ast.expr.NotExpression;
-import org.codehaus.groovy.ast.expr.PostfixExpression;
-import org.codehaus.groovy.ast.expr.PrefixExpression;
-import org.codehaus.groovy.ast.expr.PropertyExpression;
-import org.codehaus.groovy.ast.expr.RangeExpression;
-import org.codehaus.groovy.ast.expr.SpreadExpression;
-import org.codehaus.groovy.ast.expr.SpreadMapExpression;
-import org.codehaus.groovy.ast.expr.StaticMethodCallExpression;
-import org.codehaus.groovy.ast.expr.TernaryExpression;
-import org.codehaus.groovy.ast.expr.TupleExpression;
-import org.codehaus.groovy.ast.expr.UnaryMinusExpression;
-import org.codehaus.groovy.ast.expr.UnaryPlusExpression;
-import org.codehaus.groovy.ast.expr.VariableExpression;
-import org.codehaus.groovy.ast.stmt.Statement;
-import org.codehaus.groovy.control.SourceUnit;
-import org.junit.Ignore;
-
-/**
- * Tests the LineColumn information of the groovy source obtained in the
- * source parameter of the constructor
- * 
- * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf</a>
- *
- */
-@Ignore("helper class for LineColumnCheckTestSuite")
-public class LineColumnChecker extends ASTTest {
-    
-    private LineCheckVisitor visitor;
-    private String name;
-    private String source;
-    private String[] expected;
-    
-    public LineColumnChecker(String name, String source, String expected) {
-        this.name = name;
-        this.source = source;
-        this.expected = expected.split(";");
-        // Set Method to call for JUnit
-        setName("testLineColumn");
-    }
-    
-    public void setUp() {
-        visitor = new LineCheckVisitor();
-    }
-    
-    public String getName() {
-        return name;
-    }
-    
-    public void testLineColumn() {
-        visitor.visitModuleNode(getAST(source));
-        String was = visitor.getASTString();
-        //comment out next line to view the output of the visitor
-        //System.out.println(name + ": " + was);
-        for (String anExpected : expected) {
-            assertTrue("'" + anExpected + "' not found in '" + was + "'", was.indexOf(anExpected.trim()) != -1);
-        }
-    }
-}
-
-/**
- * 
- * Visitor to write for each visited node a string like:
- * [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]
- * 
- */
-class LineCheckVisitor extends ClassCodeVisitorSupport {
-    
-    private StringBuffer astString = new StringBuffer();
-    
-    public String getASTString() {
-        return astString.toString();
-    }
-
-    protected void visitStatement(Statement statement) {
-        visitNode(statement);
-    }
-    
-    protected void visitType(ClassNode node) {
-        visitNode(node);
-        visitGenerics(node);
-    }
-    
-    protected void visitTypes(ClassNode[] classNodes) {
-        if (classNodes != null) {
-            for (ClassNode classNode : classNodes) {
-                visitType(classNode);
-            }
-        }
-    }
-    
-    protected void visitGenerics(ClassNode node) {
-        if (node.isUsingGenerics()) {
-            GenericsType[] generics = node.getGenericsTypes();
-            if(generics == null) return;
-            for (GenericsType genericType : generics) {
-                visitNode(genericType);
-                visitType(genericType.getType());
-                if (genericType.getLowerBound() != null) {
-                    visitType(genericType.getLowerBound());
-                }
-                visitTypes(genericType.getUpperBounds());
-            }
-        }
-    }
-    
-    protected void visitNodes(ASTNode[] nodes) {
-        if (nodes != null) {
-            for (ASTNode node : nodes) {
-                visitNode(node);
-            }
-        }
-    }
-
-    protected void visitNode(ASTNode node) {
-        String nodeName = node.getClass().getName();
-        //get classname without package
-        nodeName = nodeName.substring(nodeName.lastIndexOf(".") + 1,nodeName.length());
-        astString.append("[");
-        astString.append(nodeName);
-        astString.append(",(");
-        astString.append(node.getLineNumber());
-        astString.append(":");
-        astString.append(node.getColumnNumber());
-        astString.append("),(");
-        astString.append(node.getLastLineNumber());
-        astString.append(":");
-        astString.append(node.getLastColumnNumber());
-        astString.append(")]");
-        //String of each node looks like: [AssertStatement,(1:1),(1:20)]
-    }
-
-    public SourceUnit getSourceUnit() {
-        return null;
-    }
-
-    public void visitModuleNode(ModuleNode moduleNode) {
-        
-        //visit imports like import java.io.File and import java.io.File as MyFile
-        for (ImportNode importNode : moduleNode.getImports()) {
-            visitNode(importNode.getType());
-        }
-        
-        //visit static imports like import java.lang.Math.*
-        for (ImportNode importNode : moduleNode.getStaticStarImports().values()) {
-            visitNode(importNode.getType());
-        }
-        
-        //visit static imports like import java.lang.Math.cos
-        for (ImportNode importNode : moduleNode.getStaticImports().values()) {
-            visitNode(importNode.getType());
-        }
-
-        for (ClassNode classNode : moduleNode.getClasses()) {
-            if (!classNode.isScript()) {
-                visitClass(classNode);
-            } else {
-                for (MethodNode method : moduleNode.getMethods()) {
-                    visitMethod(method);
-                }
-            }
-        }
-        //visit Statements that are not inside a class
-        if (!moduleNode.getStatementBlock().isEmpty()) {
-            visitBlockStatement(moduleNode.getStatementBlock());
-        }
-    }
-
-    public void visitClass(ClassNode node) {
-        visitType(node);
-        visitType(node.getUnresolvedSuperClass());
-        visitTypes(node.getInterfaces());
-        super.visitClass(node);
-    }
-
-    public void visitAnnotations(AnnotatedNode node) {
-        List<AnnotationNode> annotationMap = node.getAnnotations();
-        if (annotationMap.isEmpty()) return;
-        visitNode(node);
-        for (AnnotationNode annotationNode : annotationMap) {
-            visitNode(annotationNode);
-        }
-    }
-    
-    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) {
-        visitAnnotations(node);
-        analyseMethodHead(node);
-        Statement code = node.getCode();
-        
-        visitClassCodeContainer(code);
-    }
-    
-    private void analyseMethodHead(MethodNode node) {
-        visitNode(node.getReturnType());
-        analyseParameters(node.getParameters());
-        visitNodes(node.getExceptions());
-    }
-    
-    private void analyseParameters(Parameter[] parameters) {
-        for (Parameter parameter : parameters) {
-            visitType(parameter.getOriginType());
-            if (parameter.hasInitialExpression()) {
-                parameter.getInitialExpression().visit(this);
-            }
-        }
-    }
-
-    public void visitConstructor(ConstructorNode node) {
-        visitNode(node);
-        super.visitConstructor(node);
-    }
-
-    public void visitMethod(MethodNode node) {
-        visitNode(node);
-        super.visitMethod(node);
-    }
-
-    public void visitField(FieldNode node) {
-        // Do not visit fields which are manually added due to optimization
-        if (!node.getName().startsWith("$")) {
-            visitType(node.getOriginType());
-            visitNode(node);
-            super.visitField(node);
-        }
-    }
-
-    public void visitProperty(PropertyNode node) {
-        // do nothing, also visited as FieldNode
-    }
-    
-    /*
-     * Statements
-     * 
-     * Statements not written here are visited in ClassCodeVisitorSupport and call there
-     * visitStatement(Statement statement) which is overridden in this class
-     */
-
-    /*
-     * Expressions
-     */
-    public void visitMethodCallExpression(MethodCallExpression call) {
-        visitNode(call);
-        super.visitMethodCallExpression(call);
-    }
-
-    public void visitStaticMethodCallExpression(StaticMethodCallExpression call) {
-        visitNode(call);
-        super.visitStaticMethodCallExpression(call);
-    }
-
-    public void visitConstructorCallExpression(ConstructorCallExpression call) {
-        visitNode(call);
-        visitType(call.getType());
-        super.visitConstructorCallExpression(call);
-    }
-
-    public void visitBinaryExpression(BinaryExpression expression) {
-        visitNode(expression);
-        super.visitBinaryExpression(expression);
-    }
-
-    public void visitTernaryExpression(TernaryExpression expression) {
-        visitNode(expression);
-        super.visitTernaryExpression(expression);
-    }
-
-    public void visitPostfixExpression(PostfixExpression expression) {
-        visitNode(expression);
-        super.visitPostfixExpression(expression);
-    }
-
-    public void visitPrefixExpression(PrefixExpression expression) {
-        visitNode(expression);
-        super.visitPrefixExpression(expression);
-    }
-
-    public void visitBooleanExpression(BooleanExpression expression) {
-        visitNode(expression);
-        super.visitBooleanExpression(expression);
-    }
-
-    public void visitNotExpression(NotExpression expression) {
-        visitNode(expression);
-        super.visitNotExpression(expression);
-    }
-
-    public void visitClosureExpression(ClosureExpression expression) {
-        visitNode(expression);
-        super.visitClosureExpression(expression);
-    }
-
-    public void visitTupleExpression(TupleExpression expression) {
-        visitNode(expression);
-        super.visitTupleExpression(expression);
-    }
-
-    public void visitListExpression(ListExpression expression) {
-        visitNode(expression);
-        super.visitListExpression(expression);
-    }
-
-    public void visitArrayExpression(ArrayExpression expression) {
-        visitNode(expression);
-        visitNode(expression.getElementType());
-        super.visitArrayExpression(expression);
-    }
-
-    public void visitMapExpression(MapExpression expression) {
-        visitNode(expression);
-        super.visitMapExpression(expression);
-    }
-
-    public void visitMapEntryExpression(MapEntryExpression expression) {
-        visitNode(expression);
-        super.visitMapEntryExpression(expression);
-    }
-
-    public void visitRangeExpression(RangeExpression expression) {
-        visitNode(expression);
-        super.visitRangeExpression(expression);
-    }
-
-    public void visitSpreadExpression(SpreadExpression expression) {
-        visitNode(expression);
-        super.visitSpreadExpression(expression);
-    }
-
-    public void visitSpreadMapExpression(SpreadMapExpression expression) {
-        visitNode(expression);
-        super.visitSpreadMapExpression(expression);
-    }
-
-    public void visitMethodPointerExpression(MethodPointerExpression expression) {
-        visitNode(expression);
-        super.visitMethodPointerExpression(expression);
-    }
-
-    public void visitBitwiseNegationExpression(
-            BitwiseNegationExpression expression) {
-        visitNode(expression);
-        super.visitBitwiseNegationExpression(expression);
-    }
-
-    public void visitCastExpression(CastExpression expression) {
-        visitNode(expression);
-        visitType(expression.getType());
-        super.visitCastExpression(expression);
-    }
-
-    public void visitConstantExpression(ConstantExpression expression) {
-        visitNode(expression);
-        super.visitConstantExpression(expression);
-    }
-
-    public void visitClassExpression(ClassExpression expression) {
-        visitNode(expression);
-        super.visitClassExpression(expression);
-    }
-
-    public void visitVariableExpression(VariableExpression expression) {
-        visitNode(expression);
-        super.visitVariableExpression(expression);
-    }
-
-    public void visitDeclarationExpression(DeclarationExpression expression) {
-        //visitNode(expression); is visited afterwards in BinaryExpression. Because
-        //super.visitDeclarationExpression calls visitBinaryExpression
-        visitType(expression.getLeftExpression().getType());
-        super.visitDeclarationExpression(expression);
-    }
-
-    public void visitPropertyExpression(PropertyExpression expression) {
-        visitNode(expression);
-        super.visitPropertyExpression(expression);
-    }
-
-    public void visitAttributeExpression(AttributeExpression expression) {
-        visitNode(expression);
-        super.visitAttributeExpression(expression);
-    }
-
-    public void visitFieldExpression(FieldExpression expression) {
-        visitNode(expression);
-        super.visitFieldExpression(expression);
-    }
-
-    public void visitGStringExpression(GStringExpression expression) {
-        visitNode(expression);
-        super.visitGStringExpression(expression);
-    }
-
-    public void visitArgumentlistExpression(ArgumentListExpression ale) {
-        //visitNode(ale); is visited afterwards in TupleExpression. Because
-        //super.visitArgumentlistExpression calls visitTupleExpression
-        super.visitArgumentlistExpression(ale);
-    }
-
-    public void visitShortTernaryExpression(ElvisOperatorExpression expression) {
-        visitNode(expression);
-        super.visitShortTernaryExpression(expression);
-    }
-
-    public void visitUnaryPlusExpression(UnaryPlusExpression expression) {
-        visitNode(expression);
-        super.visitUnaryPlusExpression(expression);
-    }
-
-    public void visitUnaryMinusExpression(UnaryMinusExpression expression) {
-        visitNode(expression);
-        super.visitUnaryMinusExpression(expression);
-    }
-
-    public void visitClosureListExpression(ClosureListExpression cle) {
-        visitNode(cle);
-        super.visitClosureListExpression(cle);
-    }
-}



[2/3] incubator-groovy git commit: reinstate linecolumn checker test suite

Posted by pa...@apache.org.
reinstate linecolumn checker test suite


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/9436c55f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/9436c55f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/9436c55f

Branch: refs/heads/GROOVY_2_4_X
Commit: 9436c55fc5a14a20bc503c46c9a837753c846ff6
Parents: 33a73b7
Author: paulk <pa...@asert.com.au>
Authored: Sun Oct 11 22:42:07 2015 +1000
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Oct 11 20:35:50 2015 +0200

----------------------------------------------------------------------
 .../groovy/ast/ClassCodeVisitorSupport.java     |  5 +
 .../org/codehaus/groovy/ast/LineColumnCheck.txt | 10 +-
 .../groovy/ast/LineColumnCheckTest.groovy       | 29 ++++++
 .../groovy/ast/LineColumnCheckTestSuite.java    | 98 ++++++++++++++++++++
 .../codehaus/groovy/ast/LineColumnChecker.java  |  2 +-
 5 files changed, 139 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/9436c55f/src/main/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java b/src/main/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
index c675b9e..848f270 100644
--- a/src/main/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
+++ b/src/main/org/codehaus/groovy/ast/ClassCodeVisitorSupport.java
@@ -100,6 +100,11 @@ public abstract class ClassCodeVisitorSupport extends CodeVisitorSupport impleme
         }
     }
 
+    public void visitBlockStatement(BlockStatement block) {
+        visitStatement(block);
+        super.visitBlockStatement(block);
+    }
+
     protected void visitClassCodeContainer(Statement code) {
         if (code != null) code.visit(this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/9436c55f/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
index 669836f..002c263 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
@@ -13,23 +13,25 @@ public class Test {
 [FieldNode,(2:24),(2:34)][ConstantExpression,(2:33),(2:34)];
 [FieldNode,(3:2),(3:26)][ConstantExpression,(3:16),(3:26)]
 
-###ifelse:::
+###ifElse:::
 if (expression) {
 	
 } else {
 	
 }
-:::[IfStatement,(1:1),(5:2)];[BlockStatement,(1:17),(3:3)];
+:::[IfStatement,(1:1),(5:2)];
+[BooleanExpression,(1:5),(1:15)][VariableExpression,(1:5),(1:15)];
+[BlockStatement,(1:17),(3:3)];
 [BlockStatement,(3:8),(5:2)]
 
-###ifwithoutElse:::
+###ifWithoutElse:::
 if (expression) {
 	
 	
 }
 :::[IfStatement,(1:1),(4:2)];[BlockStatement,(1:17),(4:2)]
 
-###ifElseif:::
+###ifElseIf:::
 if (expression) {
 
 	

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/9436c55f/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy b/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
new file mode 100644
index 0000000..f78f355
--- /dev/null
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheckTest.groovy
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements. See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership. The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License. You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied. See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.ast
+
+import junit.textui.TestRunner
+
+class LineColumnCheckTest extends GroovyTestCase {
+    // TODO simplify by having suite directly included rather than via TestRunner
+    // or better yet make whole suite a single Parameterized test
+    void testLineColumnInfo() {
+        assert TestRunner.run(LineColumnCheckTestSuite.suite()).wasSuccessful()
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/9436c55f/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java b/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
new file mode 100644
index 0000000..3e3ec60
--- /dev/null
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheckTestSuite.java
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.ast;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+
+import junit.framework.TestSuite;
+
+/**
+ * Tests the LineColumn information in file specified in TEST_FILE_PATH
+ * 
+ * The file in the specified path should look like:
+ * 
+ * ###<testname>:::
+ * <source code from which the AST will be built>
+ * :::<expected AST output>
+ * 
+ * The section above can be repeated for every new TestCase
+ * 
+ * The AST output from the visitor is quite big. Also for small source code snippets. Therefore
+ * it is possible to only specify the nodes that you want to check and separate them with a semicolon.
+ * A semicolon is also needed when you begin with a new line.
+ * Bsp: 
+ * [TryCatchStatement,(1:1),(9:2)][BlockStatement,(1:5),(3:3)];
+ * [CatchStatement,(3:3),(5:3)][BlockStatement,(3:12),(5:3)];
+ * [CatchStatement,(5:3),(7:3)][BlockStatement,(5:12),(7:3)];
+ * [BlockStatement,(7:3),(9:2)][BlockStatement,(7:11),(9:2)]
+ * 
+ * [<NodeType>,(<line>:<column>),(<lastLine>:<lastColumn>)]
+ * 
+ * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf</a>
+ *
+ */
+public class LineColumnCheckTestSuite extends TestSuite {
+
+    public static final String TEST_FILE_PATH = "./src/test/org/codehaus/groovy/ast/LineColumnCheck.txt";
+
+    public static TestSuite suite() {
+        TestSuite ts = new TestSuite("LineColumnCheckTestSuite");
+        String content;
+        try {
+            content = getContent(new FileReader(TEST_FILE_PATH));
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+        String[] tests = content.split("###");
+        String testName = "";
+        String source = "";
+        String expected;
+        for (String test : tests) {
+            String[] slicedTests = test.split(":::");
+            for (int ii = 0; ii < slicedTests.length; ii++) {
+                if (ii % 3 == 0) {
+                    testName = slicedTests[ii];
+                } else if (ii % 3 == 1) {
+                    source = slicedTests[ii].trim();
+                } else if (ii % 3 == 2) {
+                    expected = slicedTests[ii].trim();
+                    ts.addTest(new LineColumnChecker(testName, source, expected));
+                }
+            }
+        }
+        return ts;
+    }
+
+    private static String getContent(Reader reader) {
+        int character;
+        StringBuilder content = new StringBuilder();
+        try {
+            while ((character = reader.read()) != -1) {
+                content.append((char) character);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return content.toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/9436c55f/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnChecker.java b/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
index 1200a38..3694c4b 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
+++ b/src/test/org/codehaus/groovy/ast/LineColumnChecker.java
@@ -64,7 +64,7 @@ import org.junit.Ignore;
  * @author <a href="mailto:martin.kempf@gmail.com">Martin Kempf</a>
  *
  */
-@Ignore("helper class for manual testing")
+@Ignore("helper class for LineColumnCheckTestSuite")
 public class LineColumnChecker extends ASTTest {
     
     private LineCheckVisitor visitor;


[3/3] incubator-groovy git commit: GROOVY-7596: src/test/org/codehaus/groovy/ast/LineColumnCheck.txt file missing header in source release

Posted by pa...@apache.org.
GROOVY-7596: src/test/org/codehaus/groovy/ast/LineColumnCheck.txt file missing header in source release

add missing apache header


Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/d496c069
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/d496c069
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/d496c069

Branch: refs/heads/GROOVY_2_4_X
Commit: d496c069a2d36c1f9bd9351c95acda6b4093e2c0
Parents: bfbca35
Author: pascalschumacher <pa...@gmx.net>
Authored: Sun Oct 11 20:39:35 2015 +0200
Committer: pascalschumacher <pa...@gmx.net>
Committed: Sun Oct 11 20:39:35 2015 +0200

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/LineColumnCheck.txt  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/d496c069/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
index 002c263..635506f 100644
--- a/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
+++ b/src/test/org/codehaus/groovy/ast/LineColumnCheck.txt
@@ -1,3 +1,22 @@
+====
+     Licensed to the Apache Software Foundation (ASF) under one
+     or more contributor license agreements.  See the NOTICE file
+     distributed with this work for additional information
+     regarding copyright ownership.  The ASF licenses this file
+     to you under the Apache License, Version 2.0 (the
+     "License"); you may not use this file except in compliance
+     with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing,
+     software distributed under the License is distributed on an
+     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+     specific language governing permissions and limitations
+     under the License.
+====
+
 ###wholeAnnotationExpressionSelection:::
 import java.lang.annotation.*
 @Target([ElementType.TYPE])