Closed janschaefer closed 10 years ago
I guess the problem comes from the appendReplacement
call in BasePlaceholder.java:61
From the JavaDoc of appendReplacement
:
* <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
* the replacement string may cause the results to be different than if it
* were being treated as a literal replacement string. Dollar signs may be
* treated as references to captured subsequences as described above, and
* backslashes are used to escape literal characters in the replacement
* string.
I guess the solution would be to pass the argument to the quoteReplacement
method of the Matcher
class
Hi @janschaefer,
you are totally right, I have overseen that case completely :-( Sorry for the inconvenience.
Do you need a new release immediately? I can also provide a new version as snapshot which you can test your code with?
Cheers, Andreas
The only possibility we loose now, is to have a matcher group in the regular expression and refer this regular expression then placeholder processing by $1
etc.
But I think the other case is more important such that I will cope with this small flexibility loose for now ...
As I currently do not need the new features of the DataProvider I can live with version 1.8.0. The only problem is that, in addition, JGiven does not work with v1.9.0 anymore because of the @BeforeClass
support. This, however, is more a JGiven bug and can easily be fixed in JGiven. With 1.9.0, however, some JGiven tests are broken because of the $ problem :-).
Ok, I see. You can use the just published version 1.9.1-SNAPSHOT
from
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
to fix your bug in JGiven and give me feedback of some other findings. If you don't have some, I will publish a new official version :-) Ok?
I have checked it and actually it wasn't a JGiven issue, but rather a problem with the dataprovider runner that does not execute ClassRules as far as I see. I have created a new Issue #35 for that
The following test fails with v1.9.0:
Exception: