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 2019/08/19 05:52:42 UTC
[groovy] 01/02: formatting
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
commit b7c1710246028b9544bac5cfa99b5e21e3364ce3
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Aug 19 15:52:06 2019 +1000
formatting
---
src/test/groovy/bugs/Groovy2951.groovy | 22 ++---
.../classgen/asm/sc/bugs/Groovy7276Bug.groovy | 95 ++++++++++------------
2 files changed, 54 insertions(+), 63 deletions(-)
diff --git a/src/test/groovy/bugs/Groovy2951.groovy b/src/test/groovy/bugs/Groovy2951.groovy
index 20b142d..9574d72 100644
--- a/src/test/groovy/bugs/Groovy2951.groovy
+++ b/src/test/groovy/bugs/Groovy2951.groovy
@@ -24,12 +24,11 @@ final class Groovy2951 {
@Test
void testInstanceLevelMissingMethodWithRegularClosure1() {
- Groovy2951BugClass1.metaClass.methodMissing = {
- method, args ->
+ Groovy2951BugClass1.metaClass.methodMissing = { method, args ->
return method
}
- def result = new Groovy2951BugClass1().test1("arg1", "arg2")
- assert result == "test1"
+ def result = new Groovy2951BugClass1().test1('arg1', 'arg2')
+ assert result == 'test1'
}
@Test
@@ -37,22 +36,23 @@ final class Groovy2951 {
Groovy2951BugClass2.metaClass.methodMissing << { method, args ->
return method
}
- def result = new Groovy2951BugClass2().test2("arg1", "arg2")
- assert result == "test2"
+ def result = new Groovy2951BugClass2().test2('arg1', 'arg2')
+ assert result == 'test2'
}
@Test
void testInstanceLevelMissingMethodWithMethodClosure() {
Groovy2951BugClass3.metaClass.methodMissing = Groovy2951BugClass3.&mm
-
- def result = new Groovy2951BugClass3().test3("arg3", "arg4")
- assert result == "test3"
+ def result = new Groovy2951BugClass3().test3('arg1', 'arg2')
+ assert result == 'test3'
}
}
-class Groovy2951BugClass1 {}
+class Groovy2951BugClass1 {
+}
-class Groovy2951BugClass2 {}
+class Groovy2951BugClass2 {
+}
class Groovy2951BugClass3 {
static def mm(method, args) {
diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276Bug.groovy b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276Bug.groovy
index 5f2e493..3dc71f6 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276Bug.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy7276Bug.groovy
@@ -16,79 +16,70 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-
-
-
package org.codehaus.groovy.classgen.asm.sc.bugs
import groovy.transform.NotYetImplemented
import groovy.transform.stc.StaticTypeCheckingTestCase
import org.codehaus.groovy.classgen.asm.sc.StaticCompilationTestSupport
-class Groovy7276Bug extends StaticTypeCheckingTestCase implements StaticCompilationTestSupport {
+final class Groovy7276Bug extends StaticTypeCheckingTestCase implements StaticCompilationTestSupport {
+
void testShouldGoThroughPrivateBridgeAccessor() {
- assertScript '''
- class Foo {
- private i = 1
- def m() { new String().with {i}}
- }
- assert new Foo().m() == 1
- class Bar extends Foo {}
- assert new Bar().m() == 1
+ assertScript '''
+ class Foo {
+ private i = 1
+ def m() { new String().with {i}}
+ }
+ assert new Foo().m() == 1
+ class Bar extends Foo {}
+ assert new Bar().m() == 1
'''
}
void testShouldGoThroughPrivateBridgeMethod() {
- assertScript '''
- class Foo {
- private i = 1
- private def pvI() { i }
- def m() { new String().with {pvI()}}
- }
- assert new Foo().m() == 1
- class Bar extends Foo {}
- assert new Bar().m() == 1
+ assertScript '''
+ class Foo {
+ private i = 1
+ private def pvI() { i }
+ def m() { new String().with {pvI()}}
+ }
+ assert new Foo().m() == 1
+ class Bar extends Foo {}
+ assert new Bar().m() == 1
'''
}
void testPrivateAccessInInnerClass() {
- assertScript '''import groovy.transform.CompileStatic
-
-class Outer {
- private static class Inner {
-
- private Set<String> variablesToCheck = []
-
- private void checkAssertions(String name) {
- Runnable r = {
- def candidates = variablesToCheck.findAll { it == name }
+ assertScript '''
+ class Outer {
+ private static class Inner {
+ private Set<String> variablesToCheck = []
+ private void checkAssertions(String name) {
+ Runnable r = {
+ def candidates = variablesToCheck.findAll { it == name }
+ }
+ r.run()
+ }
+ }
+ static void test() {
+ new Inner().checkAssertions('name')
+ }
}
- r.run()
- }
- }
-
- static void test() {
- new Inner().checkAssertions('name')
- }
-}
-
-Outer.test()'''
+ Outer.test()
+ '''
}
@NotYetImplemented
// GROOVY-7304
void testShouldGoThroughPrivateBridgeAccessorWithWriteAccess() {
- assertScript '''
- class Foo {
- private int i = 1
- def m() { new String().with {++i}}
- }
- assert new Foo().m() == 2
- class Bar extends Foo {}
- assert new Bar().m() == 2
+ assertScript '''
+ class Foo {
+ private int i = 1
+ def m() { new String().with { ++i } }
+ }
+ assert new Foo().m() == 2
+ class Bar extends Foo {}
+ assert new Bar().m() == 2
'''
}
-
-
}