FlexibleStringExpander api questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FlexibleStringExpander api questions

Adam Heath-2
What is getOriginal supposed to return?  The original string, or one
that has been fixed up and normalized?

What is toString supposed to return?  The same as getOriginal?  Or, a
fixed up version?  Ie, if there was a parse error, a missing trailing
'}', should toString add this missing character?

Basically, what is supposed to happen when parsing a badly formatted
string, ie, "The class for [${a}] is ${a.getClass()".

Additionally, ${bsh:} and ${groovy:} weren't returning the 'bsh' or
'groovy' part in original.

I've managed to remove some dead code; there were some places that
were testing for an empty parse string, but it was already tested for
in earlier methods.

In any event, I have 100% full coverage now in FSE, and it's test
cases.  I don't have coverage on any other helper classes in that
folder, including those that are called by FSE.
Reply | Threaded
Open this post in threaded view
|

Re: FlexibleStringExpander api questions

Adrian Crum-2
--- On Fri, 2/19/10, Adam Heath <[hidden email]> wrote:
> What is getOriginal supposed to
> return?  The original string, or one
> that has been fixed up and normalized?

It is supposed to return the original string.

> What is toString supposed to return?  The same as
> getOriginal?

The same as getOriginal. I added that override recently as a convenience for debugging.

> if there was a parse error, a
> missing trailing
> '}', should toString add this missing character?

Wouldn't that be confusing or make it harder to debug bad expressions?

> Basically, what is supposed to happen when parsing a badly
> formatted
> string, ie, "The class for [${a}] is ${a.getClass()".

Throw an exception. In other words, force the programmer to fix it.

> Additionally, ${bsh:} and ${groovy:} weren't returning the
> 'bsh' or
> 'groovy' part in original.

Oops.

> I don't have coverage on any other helper
> classes in that
> folder, including those that are called by FSE.

I could help out with that. I might skip the UEL functions though - since  there are so many of them and most of them call java.* classes.

-Adrian