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

[groovy] branch master updated: GROOVY-10818: add test case

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new b28ff5679d GROOVY-10818: add test case
b28ff5679d is described below

commit b28ff5679d9f2e6ba2006755d08d4c58956b258d
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Nov 11 12:52:05 2022 -0600

    GROOVY-10818: add test case
---
 .../transform/stc/STCnAryExpressionTest.groovy     | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/test/groovy/transform/stc/STCnAryExpressionTest.groovy b/src/test/groovy/transform/stc/STCnAryExpressionTest.groovy
index 9c62bba60c..e79079f2e3 100644
--- a/src/test/groovy/transform/stc/STCnAryExpressionTest.groovy
+++ b/src/test/groovy/transform/stc/STCnAryExpressionTest.groovy
@@ -34,29 +34,38 @@ class STCnAryExpressionTest extends StaticTypeCheckingTestCase {
     void testBinaryStringPlusInt() {
         assertScript '''
             String str = 'a'
-            int str2 = 2
-            str+str2
+            int num = 2
+            str+num
         '''
     }
 
     void testBinaryObjectPlusInt() {
         shouldFailWithMessages '''
-            def str = new Object()
-            int str2 = 2
-            str+str2
+            def obj = new Object()
+            int num = 2
+            obj+num
         ''',
         'Cannot find matching method java.lang.Object#plus(int)'
     }
 
     void testBinaryIntPlusObject() {
         shouldFailWithMessages '''
-            def str = new Object()
-            int str2 = 2
-            str2+str
+            def obj = new Object()
+            int num = 2
+            num+obj
         ''',
         'Cannot find matching method int#plus(java.lang.Object)'
     }
 
+    // GROOVY-10818
+    void testBinaryTimeDurationPlus() {
+        assertScript '''import groovy.time.*
+            TimeDuration td1 = new TimeDuration(0, 1, 20, 43, 0)
+            TimeDuration td2 = new TimeDuration(0, 0, 20, 17, 0)
+            Duration d = td1 + td2
+        '''
+    }
+
     void testPrimitiveComparison() {
         assertScript '''
             1<2