You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/06/28 17:21:50 UTC

[groovy] 03/08: Remove stripMargin and pipe chars from test snippets

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit a8b6d013235b14df27bcb5fa615082eefd6a022d
Author: aalmiray <aa...@gmail.com>
AuthorDate: Sun Jun 9 14:50:53 2019 +0200

    Remove stripMargin and pipe chars from test snippets
---
 .../generated/AbstractGeneratedAstTestCase.groovy  |  2 +-
 .../groovy/generated/AutoCloneGeneratedTest.groovy | 10 ++++-----
 .../generated/AutoExternalizeGeneratedTest.groovy  | 12 +++++------
 .../groovy/generated/CanonicalGeneratedTest.groovy | 24 +++++++++++-----------
 .../generated/ConstructorsGeneratedTest.groovy     |  6 +++---
 .../groovy/generated/ImmutableGeneratedTest.groovy | 22 ++++++++++----------
 .../generated/PropertiesGeneratedTest.groovy       | 12 +++++------
 .../groovy/generated/SortableGeneratedTest.groovy  | 20 +++++++++---------
 8 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy b/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy
index b6f2fbb..873f7f2 100644
--- a/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy
+++ b/src/test/groovy/generated/AbstractGeneratedAstTestCase.groovy
@@ -9,7 +9,7 @@ import java.lang.reflect.Method
 @CompileStatic
 abstract class AbstractGeneratedAstTestCase {
     protected final Class<?> parseClass(String str) {
-        new GroovyClassLoader().parseClass(str.stripMargin())
+        new GroovyClassLoader().parseClass(str)
     }
 
     protected final void assertConstructorIsAnnotated(Class<?> classUnderTest, Class... paramTypes) {
diff --git a/src/test/groovy/generated/AutoCloneGeneratedTest.groovy b/src/test/groovy/generated/AutoCloneGeneratedTest.groovy
index a18c329..7c0f111 100644
--- a/src/test/groovy/generated/AutoCloneGeneratedTest.groovy
+++ b/src/test/groovy/generated/AutoCloneGeneratedTest.groovy
@@ -7,13 +7,13 @@ import org.junit.Test
 @CompileStatic
 class AutoCloneGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> implicitAutoClone = parseClass('''@groovy.transform.AutoClone
-       |class ClassUnderTest {
-       |}''')
+       class ClassUnderTest {
+       }''')
 
     final Class<?> explicitAutoClone = parseClass('''@groovy.transform.AutoClone
-       |class ClassUnderTest {
-       | Object clone() throws java.lang.CloneNotSupportedException { null }
-       |}''')
+       class ClassUnderTest {
+           Object clone() throws java.lang.CloneNotSupportedException { null }
+       }''')
 
     @Test
     void test_clone_is_annotated() {
diff --git a/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy b/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy
index e49d711..7f52d62 100644
--- a/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy
+++ b/src/test/groovy/generated/AutoExternalizeGeneratedTest.groovy
@@ -7,14 +7,14 @@ import org.junit.Test
 @CompileStatic
 class AutoExternalizeGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> implicitAutoExternalize = parseClass('''@groovy.transform.AutoExternalize
-       |class ClassUnderTest {
-       |}''')
+       class ClassUnderTest {
+       }''')
 
     final Class<?> explicitAutoExternalize = parseClass('''@groovy.transform.AutoExternalize
-       |class ClassUnderTest {
-       | void writeExternal(ObjectOutput out) throws IOException { }
-       | void readExternal(ObjectInput oin) { }
-       |}''')
+       class ClassUnderTest {
+           void writeExternal(ObjectOutput out) throws IOException { }
+           void readExternal(ObjectInput oin) { }
+       }''')
 
     @Test
     void test_writeExternal_is_annotated() {
diff --git a/src/test/groovy/generated/CanonicalGeneratedTest.groovy b/src/test/groovy/generated/CanonicalGeneratedTest.groovy
index 17f0f62..771670a 100644
--- a/src/test/groovy/generated/CanonicalGeneratedTest.groovy
+++ b/src/test/groovy/generated/CanonicalGeneratedTest.groovy
@@ -6,20 +6,20 @@ import org.junit.Test
 @CompileStatic
 class CanonicalGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> implicitCanonical = parseClass('''@groovy.transform.Canonical
-       |class ClassUnderTest { 
-       | String name
-       | int age
-       |}''')
+       class ClassUnderTest {
+           String name
+           int age
+       }''')
 
     final Class<?> explicitCanonical = parseClass('''@groovy.transform.Canonical
-       |class ClassUnderTest { 
-       | String name
-       | int age
-       | ClassUnderTest(String n, int a) { }
-       | boolean equals(Object o) { false }
-       | int hashCode() { 42 }
-       | String toString() { '' }
-       |}''')
+       class ClassUnderTest {
+           String name
+           int age
+           ClassUnderTest(String n, int a) { }
+           boolean equals(Object o) { false }
+           int hashCode() { 42 }
+           String toString() { '' }
+       }''')
 
     @Test
     void test_noArg_constructor_is_annotated() {
diff --git a/src/test/groovy/generated/ConstructorsGeneratedTest.groovy b/src/test/groovy/generated/ConstructorsGeneratedTest.groovy
index e0fe9d0..53a1af6 100644
--- a/src/test/groovy/generated/ConstructorsGeneratedTest.groovy
+++ b/src/test/groovy/generated/ConstructorsGeneratedTest.groovy
@@ -6,11 +6,11 @@ import org.junit.Test
 @CompileStatic
 class ConstructorsGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> noExplicitConstructors = parseClass('''class ClassUnderTest {
-       |}''')
+       }''')
 
     final Class<?> explicitNoArgConstructor = parseClass('''class ClassUnderTest {
-       | ClassUnderTest() { }
-       |}''')
+           ClassUnderTest() { }
+       }''')
 
     @Test
     void test_default_constructors_are_annotated() {
diff --git a/src/test/groovy/generated/ImmutableGeneratedTest.groovy b/src/test/groovy/generated/ImmutableGeneratedTest.groovy
index 7af3052..59244be 100644
--- a/src/test/groovy/generated/ImmutableGeneratedTest.groovy
+++ b/src/test/groovy/generated/ImmutableGeneratedTest.groovy
@@ -6,19 +6,19 @@ import org.junit.Test
 @CompileStatic
 class ImmutableGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> implicitImmutable = parseClass('''@groovy.transform.Immutable
-       |class ClassUnderTest { 
-       | String name
-       | int age
-       |}''')
+       class ClassUnderTest {
+           String name
+           int age
+       }''')
 
     final Class<?> explicitImmutable = parseClass('''@groovy.transform.Immutable
-       |class ClassUnderTest { 
-       | String name
-       | int age
-       | boolean equals(Object o) { false }
-       | int hashCode() { 42 }
-       | String toString() { '' }
-       |}''')
+       class ClassUnderTest {
+           String name
+           int age
+           boolean equals(Object o) { false }
+           int hashCode() { 42 }
+           String toString() { '' }
+       }''')
 
     @Test
     void test_noArg_constructor_is_annotated() {
diff --git a/src/test/groovy/generated/PropertiesGeneratedTest.groovy b/src/test/groovy/generated/PropertiesGeneratedTest.groovy
index 8226a62..31a2486 100644
--- a/src/test/groovy/generated/PropertiesGeneratedTest.groovy
+++ b/src/test/groovy/generated/PropertiesGeneratedTest.groovy
@@ -6,14 +6,14 @@ import org.junit.Test
 @CompileStatic
 class PropertiesGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> withProps = parseClass('''class WithProps {
-       | String name
-       |}''')
+           String name
+       }''')
 
     final Class<?> withExplicitProps = parseClass('''class WithExplicitProps {
-       | private String name
-       | String getName() { name }
-       | void setName(String n) { name = n }
-       |}''')
+           private String name
+           String getName() { name }
+           void setName(String n) { name = n }
+       }''')
 
     @Test
     void test_implicit_getName_is_annotated() {
diff --git a/src/test/groovy/generated/SortableGeneratedTest.groovy b/src/test/groovy/generated/SortableGeneratedTest.groovy
index 120f710..0184a12 100644
--- a/src/test/groovy/generated/SortableGeneratedTest.groovy
+++ b/src/test/groovy/generated/SortableGeneratedTest.groovy
@@ -7,18 +7,18 @@ import org.junit.Test
 @CompileStatic
 class SortableGeneratedTest extends AbstractGeneratedAstTestCase {
     final Class<?> implicitSortable = parseClass('''@groovy.transform.Sortable
-      |class ClassUnderTest { 
-       | String name
-       | int age
-       |}''')
+      class ClassUnderTest {
+          String name
+          int age
+      }''')
 
     final Class<?> explicitSortable = parseClass('''@groovy.transform.Sortable
-      |class ClassUnderTest { 
-       | String name
-       | int age
-       | int compareTo(Object o) { 42 }
-       | int compareTo(ClassUnderTest o) { 42 }
-       |}''')
+      class ClassUnderTest {
+          String name
+          int age
+          int compareTo(Object o) { 42 }
+          int compareTo(ClassUnderTest o) { 42 }
+      }''')
 
     @Test
     void test_compareTo_is_annotated() {