You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2020/07/01 00:25:16 UTC

[test] Bug in StringSubstitutor?

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

Re: [test] Bug in StringSubstitutor?

Posted by Melloware Inc <me...@gmail.com>.
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 <ga...@gmail.com> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org