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/01/31 09:14:40 UTC
[groovy] branch master updated: wrong author of don xijote (closes
#868)
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
The following commit(s) were added to refs/heads/master by this push:
new 8f4d026 wrong author of don xijote (closes #868)
8f4d026 is described below
commit 8f4d026f57cd5e4b91bea2d7b917554ea6547774
Author: Jorge <ja...@gmail.com>
AuthorDate: Wed Jan 30 10:21:02 2019 +0100
wrong author of don xijote (closes #868)
the author of Don Xijote was Miguel, not Manuel
---
.../src/spec/test/UserGuideXmlSlurperTest.groovy | 30 ++++++++++------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/subprojects/groovy-xml/src/spec/test/UserGuideXmlSlurperTest.groovy b/subprojects/groovy-xml/src/spec/test/UserGuideXmlSlurperTest.groovy
index fd9aa34..41b5c10 100644
--- a/subprojects/groovy-xml/src/spec/test/UserGuideXmlSlurperTest.groovy
+++ b/subprojects/groovy-xml/src/spec/test/UserGuideXmlSlurperTest.groovy
@@ -18,12 +18,10 @@
*/
package groovy.xml
-import groovy.util.GroovyTestCase
-
/**
-* Tests for the Groovy Xml user guide related to XmlSlurper.
-*/
-class UserGuideXmlSlurperTest extends GroovyTestCase {
+ * Tests for the Groovy Xml user guide related to XmlSlurper.
+ */
+class UserGuideXmlSlurperTest extends GroovyTestCase {
// tag::books[]
static final String books = '''
@@ -32,7 +30,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
<books>
<book available="20" id="1">
<title>Don Xijote</title>
- <author id="1">Manuel De Cervantes</author>
+ <author id="1">Miguel De Cervantes</author>
</book>
<book available="14" id="2">
<title>Catcher in the Rye</title>
@@ -44,7 +42,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
</book>
<book available="5" id="4">
<title>Don Xijote</title>
- <author id="4">Manuel De Cervantes</author>
+ <author id="4">Miguel De Cervantes</author>
</book>
</books>
</value>
@@ -74,7 +72,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
def response = new XmlSlurper().parseText(books)
def authorResult = response.value.books.book[0].author
- assert authorResult.text() == 'Manuel De Cervantes'
+ assert authorResult.text() == 'Miguel De Cervantes'
// end::testGettingANodeText[]
}
@@ -97,7 +95,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
def response = new XmlSlurper().parseText(books)
// .'*' could be replaced by .children()
- def catcherInTheRye = response.value.books.'*'.find { node->
+ def catcherInTheRye = response.value.books.'*'.find { node ->
// node.@id == 2 could be expressed as node['@id'] == 2
node.name() == 'book' && node.@id == '2'
}
@@ -111,7 +109,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
def response = new XmlSlurper().parseText(books)
// .'**' could be replaced by .depthFirst()
- def bookId = response.'**'.find { book->
+ def bookId = response.'**'.find { book ->
book.author.text() == 'Lewis Carroll'
}.@id
@@ -123,7 +121,7 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
// tag::testDepthFirst2[]
def response = new XmlSlurper().parseText(books)
- def titles = response.'**'.findAll{ node-> node.name() == 'title' }*.text()
+ def titles = response.'**'.findAll { node -> node.name() == 'title' }*.text()
assert titles.size() == 4
// end::testDepthFirst2[]
@@ -146,8 +144,8 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
// tag::testHelpers[]
def response = new XmlSlurper().parseText(books)
- def titles = response.value.books.book.findAll{book->
- /* You can use toInteger() over the GPathResult object */
+ def titles = response.value.books.book.findAll { book ->
+ /* You can use toInteger() over the GPathResult object */
book.@id.toInteger() > 2
}*.title
@@ -160,10 +158,10 @@ class UserGuideXmlSlurperTest extends GroovyTestCase {
def response = new XmlSlurper().parseText(books)
/* Use the same syntax as groovy.xml.MarkupBuilder */
- response.value.books.book[0].replaceNode{
- book(id:"3"){
+ response.value.books.book[0].replaceNode {
+ book(id: "3") {
title("To Kill a Mockingbird")
- author(id:"3","Harper Lee")
+ author(id: "3", "Harper Lee")
}
}