Skip to content

Commit 382827a

Browse files
committed
adding test to repro #2727
1 parent 1126ad1 commit 382827a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

karate-core/src/test/java/com/intuit/karate/MatchTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ void testArray(String matchType) {
376376

377377
@Test
378378
void testIssue2515() {
379-
380379
Json cat = Json.of(
381380
"""
382381
{
@@ -396,6 +395,18 @@ void testIssue2515() {
396395
match(cat.asMap(), EQUALS, Json.of("{ name: 'Billie', kittens: '#(^^expectedKittens2)' }").asMap(), true);
397396
}
398397

398+
@Test
399+
void testIssue2727() {
400+
Json pattern1 = Json.of("{ a: 1, b: [ { c: 3 } ] }");
401+
JsEngine.global().put("pattern1", pattern1.asMap());
402+
// should work
403+
// match("[ { a: 1, b: [ { c: 3, d: 4 } ] } ]", CONTAINS, "#(^pattern1)");
404+
// works
405+
Json pattern2 = Json.of("{ c: 3 }");
406+
JsEngine.global().put("pattern2", pattern2.asMap());
407+
match("[ { a: 1, b: [ { c: 3, d: 4 } ] } ]", CONTAINS, "{ a: 1, b: [ '#(^pattern2)' ] }");
408+
}
409+
399410
@ParameterizedTest
400411
@CsvSource(value = {
401412
"EQUALS;EACH_EQUALS",

0 commit comments

Comments
 (0)