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 2020/04/19 04:52:11 UTC
[groovy] 02/02: Check types in the test for `unaryMinus`
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit e6c4f142306b4f807871f8cbd50235d68c19c650
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Apr 19 12:49:01 2020 +0800
Check types in the test for `unaryMinus`
(cherry picked from commit 0104ca086a2fa8c6f46369c53883fb1658cbb004)
---
src/test/groovy/bugs/Groovy4414Bug.groovy | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/test/groovy/bugs/Groovy4414Bug.groovy b/src/test/groovy/bugs/Groovy4414Bug.groovy
index dfa9148..8e779da 100644
--- a/src/test/groovy/bugs/Groovy4414Bug.groovy
+++ b/src/test/groovy/bugs/Groovy4414Bug.groovy
@@ -43,9 +43,14 @@ class Groovy4414Bug extends GroovyTestCase {
}};
assertEquals(expected, InvokerHelper.unaryMinus(actual));
-
- assertEquals((short)-1, InvokerHelper.unaryMinus((short)1));
- assertEquals((byte)-1, InvokerHelper.unaryMinus((byte)1));
+
+ def negativeShortOne = InvokerHelper.unaryMinus((short) 1)
+ assert Short.class == negativeShortOne.class
+ assertEquals((short)-1, negativeShortOne);
+
+ def negativeByteOne = InvokerHelper.unaryMinus((byte) 1)
+ assert Byte.class == negativeByteOne.class
+ assertEquals((byte)-1, negativeByteOne);
}
public void testUnaryPlus() {