Re: String comparison tests on exception messages keep failing due to >'< character keeps getting removed!

OCsite <[email protected]>
Newsgroups gmane.comp.lang.groovy.user
Message-ID <[email protected]>
Tommy,

I am afraid I do not quite follow you. The assert seems to work all right, far as I can say:

===
1029 ocs /tmp> <q.groovy                            
def msg="'LAZY DEVELOPER! This is a test'"
assert msg == "'" +"LAZY DEVELOPER! This is a test" + "'"
println 'all ok'
1030 ocs /tmp> /usr/local/groovy-4.0.21/bin/groovy q
all ok
1031 ocs /tmp> 
===

Do I overlook something of importance here?

All the best,
OC

> On 13. 5. 2024, at 18:45, Tommy Svensson <[email protected]> wrote:
> 
> Here is a test I have been forced to comment out since it is 100% impossible to make work due to  '  character keeps getting removed!
> 
>         assert se3.message == "'" +"LAZY DEVELOPER! This is a test" + "'"
> 
>         
>             No matter what you do here the result will be:
> 
>                 Assertion failed:
> 
>                 assert se3.message == "'" +"LAZY DEVELOPER! This is a test" + "'"
>                        |   |
>                        |   'LAZY DEVELOPER! This is a Test'
>                        LAZY DEVELOPER! This is a Test
> 
>              That is the "'" character will be removed in the constant comparison text
>              and thus the test will always fail, not matter what I do!!!
> 
> Any suggestions ?
> 
> I'm using release 21 of Groovy.
> 
> ______________________
> Tommy Svensson
> [email protected] <mailto:[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.