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 2022/06/11 01:40:58 UTC
[groovy] 03/03: whitespace fixes (port of b54d807114 to 3_0_X)
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 46dbc56c6d2350732eda6265e5c92fece4f6b9f2
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Jun 11 11:40:46 2022 +1000
whitespace fixes (port of b54d807114 to 3_0_X)
---
src/spec/doc/core-syntax.adoc | 14 +++++++-------
src/test/gls/syntax/Gep3OrderDslTest.groovy | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/spec/doc/core-syntax.adoc b/src/spec/doc/core-syntax.adoc
index 97a6b8f5f9..d01b0e7bd8 100644
--- a/src/spec/doc/core-syntax.adoc
+++ b/src/spec/doc/core-syntax.adoc
@@ -353,7 +353,7 @@ We'll see some more escaping details when it comes to other types of strings dis
==== Unicode escape sequence
-For characters that are not present on your keyboard, you can use unicode escape sequences:
+For characters that are not present on your keyboard, you can use unicode escape sequences:
a backslash, followed by 'u', then 4 hexadecimal digits.
For example, the Euro currency symbol can be represented with:
@@ -403,7 +403,7 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=gstring_2,indent=0]
[NOTE]
Not only are expressions allowed in between the `${}` placeholder, but so are statements. However, a statement's value is just `null`.
-So if several statements are inserted in that placeholder, the last one should somehow return a meaningful value to be inserted.
+So if several statements are inserted in that placeholder, the last one should somehow return a meaningful value to be inserted.
For instance, +"The sum of 1 and 2 is equal to ${def a = 1; def b = 2; a + b}"+ is supported and works as expected but a good practice is usually to stick to simple expressions inside GString placeholders.
In addition to `${}` placeholders, we can also use a lone `$` sign prefixing a dotted expression:
@@ -535,7 +535,7 @@ NOTE: Neither double quotes nor single quotes need be escaped in triple-double-q
=== Slashy string
Beyond the usual quoted strings, Groovy offers slashy strings, which use `/` as the opening and closing delimiter.
-Slashy strings are particularly useful for defining regular expressions and patterns,
+Slashy strings are particularly useful for defining regular expressions and patterns,
as there is no need to escape backslashes.
Example of a slashy string:
@@ -568,7 +568,7 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=slashy_4,indent=0]
==== Special cases
-An empty slashy string cannot be represented with a double forward slash, as it's understood by the Groovy parser as a line comment.
+An empty slashy string cannot be represented with a double forward slash, as it's understood by the Groovy parser as a line comment.
That's why the following assert would actually not compile as it would look like a non-terminated statement:
[source,groovy]
@@ -1033,7 +1033,7 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=list_2,indent=0]
<1> Our list here contains a number, a string and a boolean value
We mentioned that by default, list literals are actually instances of `java.util.ArrayList`,
-but it is possible to use a different backing type for our lists,
+but it is possible to use a different backing type for our lists,
thanks to using type coercion with the `as` operator, or with explicit type declaration for your variables:
[source,groovy]
@@ -1128,7 +1128,7 @@ assert groovyBooks.every{ it.contains('Groovy') }
== Maps
Sometimes called dictionaries or associative arrays in other languages, Groovy features maps.
-Maps associate keys to values, separating keys and values with colons, and each key/value pairs with commas,
+Maps associate keys to values, separating keys and values with colons, and each key/value pairs with commas,
and the whole keys and values surrounded by square brackets.
[source,groovy]
@@ -1177,7 +1177,7 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=variable_key_1,indent
[NOTE]
You can also pass quoted strings as well as keys: +["name": "Guillaume"]+.
-This is mandatory if your key string isn't a valid identifier,
+This is mandatory if your key string isn't a valid identifier,
for example if you wanted to create a string key containing a hash like in: +["street-name": "Main street"]+.
When you need to pass variable values as keys in your map definitions, you must surround the variable or expression with parentheses:
diff --git a/src/test/gls/syntax/Gep3OrderDslTest.groovy b/src/test/gls/syntax/Gep3OrderDslTest.groovy
index 4aa69f9c74..efc2432353 100644
--- a/src/test/gls/syntax/Gep3OrderDslTest.groovy
+++ b/src/test/gls/syntax/Gep3OrderDslTest.groovy
@@ -77,7 +77,7 @@ class Gep3OrderDslTest extends GroovyTestCase {
assert orders[1].allOrNone == true
assert orders[1].limitPrice == 80
assert orders[1].quantity == 150
- assert orders[1].security.name == 'VMW'
+ assert orders[1].security.name == 'VMW'
}
}