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 2016/03/03 21:08:10 UTC
[1/3] groovy git commit: reinstate accidentally disabled
groovyTestCase tests
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_4_X bf1a2386c -> 342451759
reinstate accidentally disabled groovyTestCase tests
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/457b08a2
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/457b08a2
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/457b08a2
Branch: refs/heads/GROOVY_2_4_X
Commit: 457b08a27cdf40421cb613dcc85c67711be7c392
Parents: bf1a238
Author: Paul King <pa...@asert.com.au>
Authored: Sat Jun 20 14:40:56 2015 +1000
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu Mar 3 20:52:07 2016 +0100
----------------------------------------------------------------------
.../groovy/runtime/DefaultGroovyMethods.java | 39 +++++++++++---------
src/test/MainJavadocAssertionTest.groovy | 26 +++++++++++++
subprojects/groovy-json/build.gradle | 1 +
.../java/groovy/json/StreamingJsonBuilder.java | 2 +-
.../groovy/json/JsonJavadocAssertionTest.groovy | 28 ++++++++++++++
5 files changed, 78 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/457b08a2/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 4eb7d66..f0fdd19 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -1622,7 +1622,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
*
* def list = [a, b, c, d]
* List list2 = list.toUnique(new PersonComparator())
- * assert( list2 == list && list == [a, b, c] )
+ * assert list2 == [a, b, c] && list == [a, b, c, d]
* </pre>
*
* @param self an Iterable
@@ -1673,7 +1673,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
*
* def list = [a, b, c, d]
* List list2 = list.toUnique(new PersonComparator())
- * assert( list2 == list && list == [a, b, c] )
+ * assert list2 == [a, b, c] && list == [a, b, c, d]
* </pre>
*
* @param self a List
@@ -5670,7 +5670,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
/**
* Sums the items in an array, adding the result to some initial value.
- * <pre class="groovyTestCase">assert (5+1+2+3+4 as byte) == ([1,2,3,4] as byte[]).sum(5)</pre>
+ * <pre class="groovyTestCase">assert (5+1+2+3+4 as byte) == ([1,2,3,4] as byte[]).sum(5 as byte)</pre>
*
* @param self an array of values to sum
* @param initialValue the items in the array will be summed to this initial value
@@ -5687,7 +5687,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
/**
* Sums the items in an array, adding the result to some initial value.
- * <pre class="groovyTestCase">assert (5+1+2+3+4 as short) == ([1,2,3,4] as short[]).sum(5)</pre>
+ * <pre class="groovyTestCase">assert (5+1+2+3+4 as short) == ([1,2,3,4] as short[]).sum(5 as short)</pre>
*
* @param self an array of values to sum
* @param initialValue the items in the array will be summed to this initial value
@@ -5738,7 +5738,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
/**
* Sums the items in an array, adding the result to some initial value.
- * <pre class="groovyTestCase">assert (5+1+2+3+4 as char) == ([1,2,3,4] as char[]).sum(5)</pre>
+ * <pre class="groovyTestCase">assert (5+1+2+3+4 as char) == ([1,2,3,4] as char[]).sum(5 as char)</pre>
*
* @param self an array of values to sum
* @param initialValue the items in the array will be summed to this initial value
@@ -7954,7 +7954,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
* <p/>
* Example usage:
* <pre class="groovyTestCase">
- * assert [[0, "a"], [1, "b"]] == ["a", "b"].iterator().indexed().collect{ e -> [e.key, e.value] }
+ * assert [[0, "a"], [1, "b"]] == ["a", "b"].iterator().indexed().collect{ tuple -> [tuple.first, tuple.second] }
* assert ["0: a", "1: b"] == ["a", "b"].iterator().indexed().collect { idx, str -> "$idx: $str" }.toList()
* </pre>
*
@@ -8260,7 +8260,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
* is true, it is sorted in place and returned. Otherwise, the elements are first placed
* into a new list which is then sorted and returned - leaving the original Iterable unchanged.
* <pre class="groovyTestCase">
- * assert ["hi","hey","hello"] == ["hello","hi","hey"].sort( { a, b -> a.length() <=> b.length() } as Comparator )
+ * assert ["hi","hey","hello"] == ["hello","hi","hey"].sort(false, { a, b -> a.length() <=> b.length() } as Comparator )
* </pre>
* <pre class="groovyTestCase">
* def orig = ["hello","hi","Hey"]
@@ -9174,7 +9174,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
* Returns the items from the SortedSet excluding the last item. Leaves the original SortedSet unchanged.
* <pre class="groovyTestCase">
* def sortedSet = [3, 4, 2] as SortedSet
- * assert sortedSet.init() == [3, 4] as SortedSet
+ * assert sortedSet.init() == [2, 3] as SortedSet
* assert sortedSet == [3, 4, 2] as SortedSet
* </pre>
*
@@ -9824,14 +9824,14 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
/**
* Drops the given number of elements from the tail of this Iterator.
* <pre class="groovyTestCase">
- * def obliterator = "obliter8".iterator()
- * assert abc.dropRight(-1) == ['o', 'b', 'l', 'i', 't', 'e', 'r', '8']
- * assert abc.dropRight(0) == ['o', 'b', 'l', 'i', 't', 'e', 'r', '8']
- * assert abc.dropRight(1) == ['o', 'b', 'l', 'i', 't', 'e', 'r']
- * assert abc.dropRight(4) == ['o', 'b', 'l', 'i']
- * assert abc.dropRight(7) == ['o']
- * assert abc.dropRight(8) == []
- * assert abc.dropRight(9) == []
+ * def getObliterator() { "obliter8".iterator() }
+ * assert obliterator.dropRight(-1).toList() == ['o', 'b', 'l', 'i', 't', 'e', 'r', '8']
+ * assert obliterator.dropRight(0).toList() == ['o', 'b', 'l', 'i', 't', 'e', 'r', '8']
+ * assert obliterator.dropRight(1).toList() == ['o', 'b', 'l', 'i', 't', 'e', 'r']
+ * assert obliterator.dropRight(4).toList() == ['o', 'b', 'l', 'i']
+ * assert obliterator.dropRight(7).toList() == ['o']
+ * assert obliterator.dropRight(8).toList() == []
+ * assert obliterator.dropRight(9).toList() == []
* </pre>
*
* @param self the original Iterator
@@ -12000,7 +12000,12 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
/**
* Flatten a SortedSet. This SortedSet and any nested arrays or
* collections have their contents (recursively) added to the new SortedSet.
- * <pre class="groovyTestCase">assert [1,2,3,4,5] as SortedSet == ([1,[2,3],[[4]],[],5] as SortedSet).flatten()</pre>
+ * <pre class="groovyTestCase">
+ * Set nested = [[0,1],[2],3,[4],5]
+ * SortedSet sorted = new TreeSet({ a, b -> (a instanceof List ? a[0] : a) <=> (b instanceof List ? b[0] : b) } as Comparator)
+ * sorted.addAll(nested)
+ * assert [0,1,2,3,4,5] as SortedSet == sorted.flatten()
+ * </pre>
*
* @param self a SortedSet to flatten
* @return a flattened SortedSet
http://git-wip-us.apache.org/repos/asf/groovy/blob/457b08a2/src/test/MainJavadocAssertionTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/MainJavadocAssertionTest.groovy b/src/test/MainJavadocAssertionTest.groovy
new file mode 100644
index 0000000..f261d62
--- /dev/null
+++ b/src/test/MainJavadocAssertionTest.groovy
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import junit.textui.TestRunner
+
+class MainJavadocAssertionTest extends GroovyTestCase {
+ // TODO simplify by having suite directly included rather than via TestRunner
+ void testGroovyDoc() {
+ assert TestRunner.run(JavadocAssertionTestSuite.suite()).wasSuccessful()
+ }
+}
http://git-wip-us.apache.org/repos/asf/groovy/blob/457b08a2/subprojects/groovy-json/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/build.gradle b/subprojects/groovy-json/build.gradle
index af01c6a..c96a723 100644
--- a/subprojects/groovy-json/build.gradle
+++ b/subprojects/groovy-json/build.gradle
@@ -19,4 +19,5 @@
dependencies {
compile rootProject
testCompile project(':groovy-test')
+ testRuntime project(':groovy-ant')
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/457b08a2/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
index 193a088..05dbcdc 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
@@ -361,7 +361,7 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
* <li>or no argument at all</li>
* </ul>
* <p>
- * Example with a classicala builder-style:
+ * Example with a classical builder-style:
* <pre class="groovyTestCase">
* new StringWriter().with { w ->
* def json = new groovy.json.StreamingJsonBuilder(w)
http://git-wip-us.apache.org/repos/asf/groovy/blob/457b08a2/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy b/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
new file mode 100644
index 0000000..bf974a4
--- /dev/null
+++ b/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json
+
+import junit.textui.TestRunner
+
+class JsonJavadocAssertionTest extends GroovyTestCase {
+ // TODO simplify by having suite directly included rather than via TestRunner
+ void testGroovyDoc() {
+ assert TestRunner.run(JavadocAssertionTestSuite.suite()).wasSuccessful()
+ }
+}
[2/3] groovy git commit: make javadoc assertion tests more visible by
directly running JavadocAssertionTestSuite rather than running it via a
TestRunner
Posted by pa...@apache.org.
make javadoc assertion tests more visible by directly running JavadocAssertionTestSuite rather than running it via a TestRunner
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/84e86678
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/84e86678
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/84e86678
Branch: refs/heads/GROOVY_2_4_X
Commit: 84e86678b54972b3a71f54abfdb837b568d331a9
Parents: 457b08a
Author: pascalschumacher <pa...@gmx.net>
Authored: Thu Mar 3 20:21:40 2016 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu Mar 3 20:59:35 2016 +0100
----------------------------------------------------------------------
src/test/MainJavadocAssertionTest.groovy | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/84e86678/src/test/MainJavadocAssertionTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/MainJavadocAssertionTest.groovy b/src/test/MainJavadocAssertionTest.groovy
index f261d62..7405ff8 100644
--- a/src/test/MainJavadocAssertionTest.groovy
+++ b/src/test/MainJavadocAssertionTest.groovy
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-import junit.textui.TestRunner
-class MainJavadocAssertionTest extends GroovyTestCase {
- // TODO simplify by having suite directly included rather than via TestRunner
- void testGroovyDoc() {
- assert TestRunner.run(JavadocAssertionTestSuite.suite()).wasSuccessful()
- }
+import org.junit.runners.Suite
+import org.junit.runner.RunWith
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses(JavadocAssertionTestSuite.class)
+class MainJavadocAssertionTest {
}
[3/3] groovy git commit: make javadoc assertion tests more visible by
directly running JavadocAssertionTestSuite rather than running it via a
TestRunner
Posted by pa...@apache.org.
make javadoc assertion tests more visible by directly running JavadocAssertionTestSuite rather than running it via a TestRunner
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/34245175
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/34245175
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/34245175
Branch: refs/heads/GROOVY_2_4_X
Commit: 342451759a1afe034cae6931d218c6ca57788048
Parents: 84e8667
Author: pascalschumacher <pa...@gmx.net>
Authored: Thu Mar 3 20:33:18 2016 +0100
Committer: pascalschumacher <pa...@gmx.net>
Committed: Thu Mar 3 20:59:35 2016 +0100
----------------------------------------------------------------------
src/test/MainJavadocAssertionTest.groovy | 4 ++--
.../groovy/groovy/json/JsonJavadocAssertionTest.groovy | 11 +++++------
2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/34245175/src/test/MainJavadocAssertionTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/MainJavadocAssertionTest.groovy b/src/test/MainJavadocAssertionTest.groovy
index 7405ff8..7ff8712 100644
--- a/src/test/MainJavadocAssertionTest.groovy
+++ b/src/test/MainJavadocAssertionTest.groovy
@@ -20,7 +20,7 @@
import org.junit.runners.Suite
import org.junit.runner.RunWith
-@RunWith(Suite.class)
-@Suite.SuiteClasses(JavadocAssertionTestSuite.class)
+@RunWith(Suite)
+@Suite.SuiteClasses(JavadocAssertionTestSuite)
class MainJavadocAssertionTest {
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/34245175/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy b/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
index bf974a4..e1ff1a8 100644
--- a/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
+++ b/subprojects/groovy-json/src/test/groovy/groovy/json/JsonJavadocAssertionTest.groovy
@@ -18,11 +18,10 @@
*/
package groovy.json
-import junit.textui.TestRunner
+import org.junit.runners.Suite
+import org.junit.runner.RunWith
-class JsonJavadocAssertionTest extends GroovyTestCase {
- // TODO simplify by having suite directly included rather than via TestRunner
- void testGroovyDoc() {
- assert TestRunner.run(JavadocAssertionTestSuite.suite()).wasSuccessful()
- }
+@RunWith(Suite)
+@Suite.SuiteClasses(JavadocAssertionTestSuite)
+class JsonJavadocAssertionTest {
}