This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_4_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 08c01a29b64f330454c7fb81ff2759bf0eb80cdc Author: Daniel Sun <[email protected]> AuthorDate: Sat Sep 17 21:55:36 2022 +0800 Trivial tweak for Operators documentation (cherry picked from commit 0b8f0dfd4a4d93f437a64502c7f8c44e04d5a711) --- src/spec/doc/core-operators.adoc | 3 ++- src/spec/test/OperatorsTest.groovy | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/spec/doc/core-operators.adoc b/src/spec/doc/core-operators.adoc index 4f8ce46b93..50dde78560 100644 --- a/src/spec/doc/core-operators.adoc +++ b/src/spec/doc/core-operators.adoc @@ -812,7 +812,8 @@ include::../test/OperatorsTest.groovy[tags=identity_op,indent=0] <1> Create a list of strings <2> Create another list of strings containing the same elements <3> using `==`, we test object equality, equivalent to `list1.equals(list2)` in Java -<4> but using `is`, we can check that references are distinct, equivalent to `list1 != list2` in Java +<4> using `is`, we can check that references are distinct, equivalent to `list1 == list2` in Java +<5> using `===` or `!==` (supported and recommended since Groovy 3.0.0), we can also check whether references are distinct or not, equivalent to `list1 == list2` and `list1 != list2` in Java === Coercion operator diff --git a/src/spec/test/OperatorsTest.groovy b/src/spec/test/OperatorsTest.groovy index 1a87eb6e84..a37b369fd9 100644 --- a/src/spec/test/OperatorsTest.groovy +++ b/src/spec/test/OperatorsTest.groovy @@ -622,6 +622,7 @@ assert function(*args,5,6) == 26 def list2 = ['Groovy 1.8','Groovy 2.0','Groovy 2.3'] // <2> assert list1 == list2 // <3> assert !list1.is(list2) // <4> + assert list1 !== list2 // <5> // end::identity_op[] }
