forked from bazelbuild/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation tests for Groovy AST transformations (bazelbuild#863)
* groovy.beans.Bindable * groovy.beans.Vetoable * groovy.transform.AutoExternalize * groovy.transform.IndexedProperty
- Loading branch information
Showing
10 changed files
with
245 additions
and
16 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...ion.groovy/src/org/jacoco/core/test/validation/groovy/GroovyAutoExternalizeClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy; | ||
|
||
import org.jacoco.core.test.validation.ValidationTestBase; | ||
import org.jacoco.core.test.validation.groovy.targets.GroovyAutoExternalizeClassTarget; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test of class with {@link groovy.transform.AutoExternalize} annotation. | ||
*/ | ||
public class GroovyAutoExternalizeClassTest extends ValidationTestBase { | ||
public GroovyAutoExternalizeClassTest() { | ||
super(GroovyAutoExternalizeClassTarget.class); | ||
} | ||
|
||
@Test | ||
public void test_method_count() { | ||
assertMethodCount(1); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...validation.groovy/src/org/jacoco/core/test/validation/groovy/GroovyBindableClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy; | ||
|
||
import org.jacoco.core.test.validation.ValidationTestBase; | ||
import org.jacoco.core.test.validation.groovy.targets.GroovyBindableClassTarget; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test of class with {@link groovy.beans.Bindable} annotation. | ||
*/ | ||
public class GroovyBindableClassTest extends ValidationTestBase { | ||
public GroovyBindableClassTest() { | ||
super(GroovyBindableClassTarget.class); | ||
} | ||
|
||
@Test | ||
public void test_method_count() { | ||
assertMethodCount(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ation.groovy/src/org/jacoco/core/test/validation/groovy/GroovyIndexPropertyClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy; | ||
|
||
import org.jacoco.core.test.validation.ValidationTestBase; | ||
import org.jacoco.core.test.validation.groovy.targets.GroovyIndexPropertyClassTarget; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test of class with fields annotated by {@link groovy.transform.IndexedProperty} annotation. | ||
*/ | ||
public class GroovyIndexPropertyClassTest extends ValidationTestBase { | ||
public GroovyIndexPropertyClassTest() { | ||
super(GroovyIndexPropertyClassTarget.class); | ||
} | ||
|
||
@Test | ||
public void test_method_count() { | ||
assertMethodCount(1); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...validation.groovy/src/org/jacoco/core/test/validation/groovy/GroovyVetoableClassTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy; | ||
|
||
import org.jacoco.core.test.validation.ValidationTestBase; | ||
import org.jacoco.core.test.validation.groovy.targets.GroovyVetoableClassTarget; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Test of class with {@link groovy.beans.Vetoable} annotation. | ||
*/ | ||
public class GroovyVetoableClassTest extends ValidationTestBase { | ||
public GroovyVetoableClassTest() { | ||
super(GroovyVetoableClassTarget.class); | ||
} | ||
|
||
@Test | ||
public void test_method_count() { | ||
assertMethodCount(1); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...rc/org/jacoco/core/test/validation/groovy/targets/GroovyAutoExternalizeClassTarget.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy.targets | ||
|
||
import groovy.transform.AutoExternalize | ||
|
||
@AutoExternalize | ||
class GroovyAutoExternalizeClassTarget { // assertEmpty() | ||
|
||
String first // assertEmpty() | ||
List favItems // assertEmpty() | ||
Date since // assertEmpty() | ||
|
||
static void main(String[] args) { | ||
new GroovyAutoExternalizeClassTarget() // assertFullyCovered() | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...roovy/src/org/jacoco/core/test/validation/groovy/targets/GroovyBindableClassTarget.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy.targets | ||
|
||
import groovy.beans.Bindable | ||
|
||
class GroovyBindableClassTarget { // assertEmpty() | ||
|
||
@Bindable | ||
String firstName // assertEmpty() | ||
|
||
@Bindable | ||
def zipCode // assertEmpty() | ||
|
||
static void main(String[] args) { | ||
new GroovyBindableClassTarget() // assertFullyCovered() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../src/org/jacoco/core/test/validation/groovy/targets/GroovyIndexPropertyClassTarget.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy.targets | ||
|
||
import groovy.io.FileType | ||
import groovy.transform.IndexedProperty | ||
|
||
class GroovyIndexPropertyClassTarget { // assertEmpty() | ||
|
||
@IndexedProperty | ||
FileType[] someField // assertEmpty() | ||
@IndexedProperty | ||
List otherField // assertEmpty() | ||
@IndexedProperty | ||
List furtherField // assertEmpty() | ||
|
||
static void main(String[] args) { | ||
new GroovyIndexPropertyClassTarget() // assertFullyCovered() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...roovy/src/org/jacoco/core/test/validation/groovy/targets/GroovyVetoableClassTarget.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Stephan Classen | ||
* Vadim Bauer | ||
* | ||
*******************************************************************************/ | ||
package org.jacoco.core.test.validation.groovy.targets | ||
|
||
import groovy.beans.Vetoable | ||
|
||
@Vetoable | ||
class GroovyVetoableClassTarget { // assertEmpty() | ||
|
||
String firstName // assertEmpty() | ||
def zipCode // assertEmpty() | ||
|
||
static void main(String[] args) { | ||
new GroovyVetoableClassTarget() // assertFullyCovered() | ||
} | ||
} |