mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
fix pattern matching for inline bindings with curly braces
This commit is contained in:
parent
07000d794b
commit
d7192e7b9a
@ -37,7 +37,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class BindPointParser implements BiFunction<String, Map<String, String>, BindPointParser.Result> {
|
||||
|
||||
public final static Pattern BINDPOINT_ANCHOR = Pattern.compile("(\\{((?<anchor>\\w+[-_\\d\\w.]*)})|(\\{\\{(?<extended>[^}]+?)}}))");
|
||||
public final static Pattern BINDPOINT_ANCHOR = Pattern.compile("(\\{((?<anchor>\\w+[-_\\d\\w.]*)})|(\\{\\{(?<extended>(?!}}).+?)}}))");
|
||||
public final static String DEFINITION = "DEFINITION";
|
||||
|
||||
|
||||
|
@ -48,6 +48,19 @@ public class BindPointParserTest {
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurlyBracesWithinPattern() {
|
||||
BindPointParser bpp = new BindPointParser();
|
||||
assertThat(bpp.apply("a{{Template(\"-{}-\",Combinations(\"a-z\"))}}b", Map.of())).isEqualTo(
|
||||
new BindPointParser.Result(
|
||||
List.of("a","Template(\"-{}-\",Combinations(\"a-z\"))","b"),
|
||||
List.of(
|
||||
BindPoint.of(BindPointParser.DEFINITION,"Template(\"-{}-\",Combinations(\"a-z\"))", BindPoint.Type.definition)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user