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:07:01 UTC
[groovy] 01/03: whitespace cleanup
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit b28c2803ccab11634b54c5129153054efc91ffeb
Author: Kenyon Ralph <qu...@quicinc.com>
AuthorDate: Wed Jun 1 16:36:49 2022 -0700
whitespace cleanup
---
src/spec/doc/core-syntax.adoc | 14 +++++++-------
src/test/gls/syntax/Gep3OrderDslTest.groovy | 4 ++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/spec/doc/core-syntax.adoc b/src/spec/doc/core-syntax.adoc
index a60cff8048..263768bac6 100644
--- a/src/spec/doc/core-syntax.adoc
+++ b/src/spec/doc/core-syntax.adoc
@@ -373,7 +373,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:
@@ -423,7 +423,7 @@ include::../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:
@@ -555,7 +555,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:
@@ -588,7 +588,7 @@ include::../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]
@@ -732,7 +732,7 @@ include::../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]
@@ -827,7 +827,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]
@@ -876,7 +876,7 @@ include::../test/SyntaxTest.groovy[tags=variable_key_1,indent=0]
[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 dash 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 8e5948fe2d..bfd2f3c31b 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'
}
}
@@ -187,4 +187,4 @@ class CustomBinding extends Binding {
// like "to" and "the" in our DSL
null
}
-}
\ No newline at end of file
+}