You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2023/01/12 18:09:55 UTC
[groovy] branch master updated: improve coverage (take 2)
This is an automated email from the ASF dual-hosted git repository.
paulk 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 64f599e95b improve coverage (take 2)
64f599e95b is described below
commit 64f599e95ba22bad852bb0ec18c6940a6ef2510b
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Jan 13 04:09:45 2023 +1000
improve coverage (take 2)
---
.../groovy/runtime/ArrayGroovyMethodsTest.groovy | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/test/org/codehaus/groovy/runtime/ArrayGroovyMethodsTest.groovy b/src/test/org/codehaus/groovy/runtime/ArrayGroovyMethodsTest.groovy
index e25c673b0b..1fdc62581c 100644
--- a/src/test/org/codehaus/groovy/runtime/ArrayGroovyMethodsTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/ArrayGroovyMethodsTest.groovy
@@ -20,6 +20,7 @@ package org.codehaus.groovy.runtime
import org.junit.Test
+import static groovy.test.GroovyAssert.assertScript
import static groovy.test.GroovyAssert.shouldFail
/**
@@ -62,6 +63,32 @@ class ArrayGroovyMethodsTest {
assertUnsupportedOperationForAllPrimitiveEmptyArrays('tail')
}
+ @Test
+ void testAsBooleanForNullBooleanArray() {
+ assertScript '''
+ @groovy.transform.CompileStatic
+ def method() {
+ boolean[] array = null
+ assert !array.asBoolean()
+ }
+
+ method()
+ '''
+ }
+
+ @Test
+ void testAsBooleanForNullByteArray() {
+ assertScript '''
+ @groovy.transform.CompileStatic
+ def method() {
+ byte[] array = null
+ assert !array.asBoolean()
+ }
+
+ method()
+ '''
+ }
+
private static assertUnsupportedOperationForAllPrimitiveEmptyArrays(String method) {
assertUnsupportedOperationForGivenPrimitiveEmptyArrays(method,
['boolean', 'byte', 'char', 'short', 'int', 'long', 'float', 'double'])