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/10/21 14:35:13 UTC
groovy git commit: GROOVY-7291: add test to cover all primitives
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_4_X d319b8a18 -> 7d1734af5
GROOVY-7291: add test to cover all primitives
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7d1734af
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7d1734af
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7d1734af
Branch: refs/heads/GROOVY_2_4_X
Commit: 7d1734af55662668707cd7f8b6fbee1b7ed31ada
Parents: d319b8a
Author: John Wagenleitner <jw...@apache.org>
Authored: Fri Oct 21 07:33:15 2016 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Fri Oct 21 07:33:15 2016 -0700
----------------------------------------------------------------------
src/test/groovy/bugs/Groovy7291Bug.groovy | 48 ++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/7d1734af/src/test/groovy/bugs/Groovy7291Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy7291Bug.groovy b/src/test/groovy/bugs/Groovy7291Bug.groovy
index 22203d0..f82925c 100644
--- a/src/test/groovy/bugs/Groovy7291Bug.groovy
+++ b/src/test/groovy/bugs/Groovy7291Bug.groovy
@@ -43,4 +43,52 @@ class Groovy7291Bug extends GroovyTestCase {
''')
}
+ void testPrimitiveDeclarationHasDefaultValueInClosure() {
+ assertScript '''
+ boolean z
+ byte b
+ char c
+ short s
+ int i
+ long j
+ float f
+ double d
+ def cl = {
+ assert z == false && z.class == Boolean
+ assert b == 0 && b.class == Byte
+ assert c == '\u0000' && c.class == Character
+ assert s == 0 && s.class == Short
+ assert i == 0 && i.class == Integer
+ assert j == 0L && j.class == Long
+ assert f == 0.0f && f.class == Float
+ assert d == 0.0d && d.class == Double
+ }
+ cl()
+ '''
+ }
+
+ void testWrapperDeclarationIsNullInClosure() {
+ assertScript '''
+ Boolean z
+ Byte b
+ Character c
+ Short s
+ Integer i
+ Long j
+ Float f
+ Double d
+ def cl = {
+ assert z == null
+ assert b == null
+ assert c == null
+ assert s == null
+ assert i == null
+ assert j == null
+ assert f == null
+ assert d == null
+ }
+ cl()
+ '''
+ }
+
}