This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 2004c798079a4cda4634fbf5965192cc58a26e42
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 1298f7ef24..81b71e166f 100644
--- a/src/spec/doc/core-operators.adoc
+++ b/src/spec/doc/core-operators.adoc
@@ -804,7 +804,8 @@ 
include::{projectdir}/src/spec/test/OperatorsTest.groovy[tags=identity_op,indent
 <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 16911bbead..7b0c9b02ec 100644
--- a/src/spec/test/OperatorsTest.groovy
+++ b/src/spec/test/OperatorsTest.groovy
@@ -620,6 +620,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[]
     }
 

Reply via email to