eric-milles commented on code in PR #2371:
URL: https://github.com/apache/groovy/pull/2371#discussion_r2708388482
##########
src/test/groovy/groovy/BreakContinueLabelTest.groovy:
##########
@@ -20,38 +20,102 @@ package groovy
import org.junit.jupiter.api.Test
+import static groovy.test.GroovyAssert.shouldFail
import static org.junit.jupiter.api.Assertions.fail
final class BreakContinueLabelTest {
@Test
- void testDeclareSimpleLabel() {
- label_1: assert true
+ void testDeclareSimpleLabels() {
+ label_1: print('foo')
label_2:
- assert true
+ print('bar')
+ }
+
+ // GROOVY-7463
+ @Test
+ void testBreakLabelInIfStatement() {
+ boolean flag = true
+ label:
+ if (flag) {
+ print('foo')
+ if (flag) {
+ break label
+ fail()
+ }
+ fail()
+ } else {
+ fail()
+ }
+ print('bar')
Review Comment:
@paulk-asert One note about this style of test: compilation happens before
JUnit execution and so coverage is not recorded for the compiler.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]