Skip to content

Commit a07b3fd

Browse files
authored
fix handling of curly braces in KEYS (#263)
1 parent e90b258 commit a07b3fd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/java/com/github/fppt/jedismock/Utils.java

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public static String createRegexFromGlob(String glob)
8282
case '\\':
8383
out.append("\\\\");
8484
break;
85+
case '{':
86+
out.append("\\{");
87+
break;
8588
default:
8689
out.append(c);
8790
}

src/test/java/com/github/fppt/jedismock/comparisontests/keys/KeysOperationsTest.java

+9
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,13 @@ public void testPersist(Jedis jedis) throws Exception {
9999
//Check that the value is still there
100100
assertEquals("v", jedis.get("a"));
101101
}
102+
103+
@TestTemplate
104+
public void handleCurlyBraces(Jedis jedis) {
105+
jedis.mset("{hashslot}:one", "1", "{hashslot}:two", "2", "three", "3");
106+
107+
Set<String> results = jedis.keys("{hashslot}:*");
108+
assertEquals(2, results.size());
109+
assertTrue(results.contains("{hashslot}:one") && results.contains("{hashslot}:two"));
110+
}
102111
}

0 commit comments

Comments
 (0)