Skip to content

Commit 5322f07

Browse files
Jan WlokaGodin
authored andcommitted
Add validation test for groovy.lang.Delegate (bazel-contrib#861)
1 parent d098473 commit 5322f07

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Jan Wloka - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.jacoco.core.test.validation.groovy;
13+
14+
import org.jacoco.core.test.validation.ValidationTestBase;
15+
import org.jacoco.core.test.validation.groovy.targets.GroovyDelegateClassTarget;
16+
import org.junit.Test;
17+
18+
/**
19+
* Test of class with field annotated by {@link groovy.lang.Delegate}.
20+
*/
21+
public class GroovyDelegateClassTest extends ValidationTestBase {
22+
public GroovyDelegateClassTest() {
23+
super(GroovyDelegateClassTarget.class);
24+
}
25+
26+
@Test
27+
public void test_method_count() {
28+
assertMethodCount(4);
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Jan Wloka - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.jacoco.core.test.validation.groovy.targets
13+
14+
class GroovyDelegateClassTarget { // assertEmpty()
15+
16+
static class D {
17+
void m1() {
18+
} // assertFullyCovered()
19+
20+
void m2() {
21+
} // assertFullyCovered()
22+
}
23+
24+
@Delegate
25+
D delegate = new D() // assertEmpty()
26+
27+
void m2() {
28+
delegate.m2() // assertFullyCovered()
29+
}
30+
31+
static void main(String[] args) {
32+
new GroovyDelegateClassTarget().m1()
33+
new GroovyDelegateClassTarget().m2()
34+
}
35+
36+
}

0 commit comments

Comments
 (0)