[test] Bug in StringSubstitutor?

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

[test] Bug in StringSubstitutor?

garydgregory
Hi All:

I think we might have a bug in StringSubstitutor exemplified in a comment I
just added in:

org.apache.commons.text.StringSubstitutorTest.testReplaceWeirdPattens()

        doTestNoReplace("${");
        // TODO this looks like a bug since a $ is removed but this is not
a variable.
        // doTestNoReplace("$${");
        // doTestNoReplace("$${a");
        // doTestNoReplace("$$${");
        // doTestNoReplace("$$${a");

I thought that we would only strip $ in front of a _complete_ variable, not
anywhere in front of a variable _prefix_.

Granted this is an edge case but still...

Any thoughts?

Gary
Reply | Threaded
Open this post in threaded view
|

Re: [test] Bug in StringSubstitutor?

Melloware Inc

Gary,

I agree with you it’s a bug. I would not expect that behavior from that method.

Mello

> On Jun 30, 2020, at 8:25 PM, Gary Gregory <[hidden email]> wrote:
>
> Hi All:
>
> I think we might have a bug in StringSubstitutor exemplified in a comment I
> just added in:
>
> org.apache.commons.text.StringSubstitutorTest.testReplaceWeirdPattens()
>
>        doTestNoReplace("${");
>        // TODO this looks like a bug since a $ is removed but this is not
> a variable.
>        // doTestNoReplace("$${");
>        // doTestNoReplace("$${a");
>        // doTestNoReplace("$$${");
>        // doTestNoReplace("$$${a");
>
> I thought that we would only strip $ in front of a _complete_ variable, not
> anywhere in front of a variable _prefix_.
>
> Granted this is an edge case but still...
>
> Any thoughts?
>
> Gary

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]