You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2016/08/07 07:17:23 UTC

groovy git commit: Add tests for valid and invalid integer literals (closes #373)

Repository: groovy
Updated Branches:
  refs/heads/master ef86c2c4d -> 584d4d405


Add tests for valid and invalid integer literals (closes #373)

Some of these tests currently fail because of:
https://issues.apache.org/jira/browse/GROOVY-7385


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

Branch: refs/heads/master
Commit: 584d4d405061a08c317ea1297c2833f93445bcb7
Parents: ef86c2c
Author: Sean Gilligan <se...@msgilligan.com>
Authored: Tue Jul 26 01:10:27 2016 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Sat Aug 6 23:29:33 2016 -0700

----------------------------------------------------------------------
 src/spec/test/SyntaxTest.groovy | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/584d4d40/src/spec/test/SyntaxTest.groovy
----------------------------------------------------------------------
diff --git a/src/spec/test/SyntaxTest.groovy b/src/spec/test/SyntaxTest.groovy
index e68f018..008ad09 100644
--- a/src/spec/test/SyntaxTest.groovy
+++ b/src/spec/test/SyntaxTest.groovy
@@ -153,6 +153,33 @@ class SyntaxTest extends CompilableTestSupport {
         '''
     }
 
+    void testValidIntegerLiterals() {
+        shouldCompile '''
+             def a = 2147483647I
+             def b = -2147483648I
+             def c = -2147483647I
+             def d = 9223372036854775807L
+             def e = -9223372036854775808L
+             def f = -9223372036854775807L
+         '''
+    }
+
+    void testInvalidIntegerLiteral() {
+        shouldNotCompile '''
+            // tag::invalid_integer_literal[]
+            def n = 2147483648I
+            // end::invalid_integer_literal[]
+        '''
+    }
+
+    void testInvalidLongLiteral() {
+        shouldNotCompile '''
+            // tag::invalid_long_literal[]
+            def n = 9223372036854775808L
+            // end::invalid_long_literal[]
+        '''
+    }
+
     void testAllKeywordsAreValidIdentifiersFollowingADot() {
         shouldCompile '''
         def foo = [:]