You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2018/06/02 12:55:36 UTC

groovy git commit: Move the test of GROOVY-8613 to parser-antlr4 sub-project

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 7a221ef20 -> 5531e6ca0


Move the test of GROOVY-8613 to parser-antlr4 sub-project


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 5531e6ca06ad7efb8b0a0006c0d3dcc602628cfc
Parents: 7a221ef
Author: danielsun1106 <re...@hotmail.com>
Authored: Sat Jun 2 20:55:52 2018 +0800
Committer: danielsun1106 <re...@hotmail.com>
Committed: Sat Jun 2 20:55:52 2018 +0800

----------------------------------------------------------------------
 .../parser/antlr4/GroovyParserTest.groovy       |  2 +
 .../test/resources/bugs/BUG-GROOVY-8613.groovy  | 54 ++++++++++++++++++++
 2 files changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5531e6ca/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
index 0d55a39..0d73dde 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
@@ -440,5 +440,7 @@ class GroovyParserTest extends GroovyTestCase {
 
         doRunAndTest('bugs/BUG-GROOVY-8426.groovy')
         doTest('bugs/BUG-GROOVY-8511.groovy')
+
+        doRunAndTest('bugs/BUG-GROOVY-8613.groovy')
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/5531e6ca/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8613.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8613.groovy b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8613.groovy
new file mode 100644
index 0000000..4e527f2
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-8613.groovy
@@ -0,0 +1,54 @@
+/*
+ *  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 bugs
+
+class Groovy8613Bug extends GroovyTestCase {
+    void testElvisAssign() {
+        assertScript '''
+        @groovy.transform.CompileStatic
+        def foo() {
+          def a = 0
+          a ?= 1
+          assert 1 == a
+          def b = 0
+          b ?= "hello"
+          assert 'hello' == b
+        }
+        
+        foo()
+        '''
+    }
+
+
+    void testElvisOp() {
+        assertScript '''
+        @groovy.transform.CompileStatic
+        def foo() {
+          def a = 0
+          a = a ?: 1
+          assert 1 == a
+          def b = 0
+          b = b ?: "hello"
+          assert 'hello' == b
+        }
+        
+        foo()
+        '''
+    }
+}
\ No newline at end of file