[ 
https://issues.apache.org/jira/browse/GROOVY-12052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18084631#comment-18084631
 ] 

ASF GitHub Bot commented on GROOVY-12052:
-----------------------------------------

Copilot commented on code in PR #2573:
URL: https://github.com/apache/groovy/pull/2573#discussion_r3329524805


##########
subprojects/groovy-contracts/src/test/groovy/org/apache/groovy/contracts/tests/post/SimplePostconditionTests.groovy:
##########
@@ -166,8 +166,9 @@ class Account {
         }
     }
 
+    // GROOVY-12052
     @Test
-    void no_postcondition_on_static_methods() {
+    void postcondition_on_static_void_method() {

Review Comment:
   This test is named for the static `void` case, but the method under test is 
`def` and returns `amount`, so the newly enabled static postcondition path for 
primitive `void` methods is still untested. Making this source method actually 
`void` keeps the intended coverage and exercises the branch that appends 
postconditions without a `result` value.





> groovy-contracts @Ensures could support static methods
> ------------------------------------------------------
>
>                 Key: GROOVY-12052
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12052
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> @Ensures supports an "old" notation for the (instance) value before the call. 
> Instead of banning @Ensures for static methods, we should just not allow the 
> "old" notation to appear in the contract.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to