That ticket was useful. Just out of curiosity, is there a way to make the DSL 
work if I do provide a function assert? I’m not sure it could, because you’d 
need to support operators, and also when I tried to make such a DSL I was not 
able to actually declare any symbol assert and be able to call it how I’d 
expect. Even if it worked you’d lose power assert. I wonder (not that I think 
it would be worth it) if it’s even possible to implement with an AST? I’m 
thinking even that is not possible because Groovy can’t even parse the syntax 
so you’d never get to AST stage.

Jason

From: Paul King [mailto:pa...@asert.com.au]
Sent: Sunday, November 08, 2015 1:27 AM
To: users@groovy.incubator.apache.org
Subject: Re: Command Chain in assert


To rephrase slightly,  it's not *currently* possible. We could change the 
grammar and add a special parsing rule but then that would probably rule out 
DSLs with assert as the first word. The parens proposal in the previously 
referenced jira is more likely the way we'd want to go.
On 8 Nov 2015 3:17 am, "Pascal Schumacher" 
<pascalschumac...@gmx.net<mailto:pascalschumac...@gmx.net>> wrote:
I guess it's not possible. :(

There is already an enhancement request 
https://issues.apache.org/jira/browse/GROOVY-4808 "Command Chain + Power Assert 
doesn't work" in JIRA.

-Pascal

Am 06.11.2015 um 22:42 schrieb Winnebeck, Jason:
Is it possible to support command chain in asserts? I'm trying to create a 
testing DSL.

The expression item("abc").exists will return a boolean. So I can do this:

item "abc" exists

But I can't do this:
assert item "abc" exists

Is something like that possible?

Jason

----------------------------------------------------------------------
This email message and any attachments are for the sole use of the intended 
recipient(s). Any unauthorized review, use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please contact the sender by 
reply email and destroy all copies of the original message and any attachments.

Reply via email to