mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: fix glob translation with \ at the end (#4608)
disable wrong tests in fakeredis. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
59cd931113
commit
ff7a0d58e6
3 changed files with 8 additions and 6 deletions
|
@ -248,6 +248,7 @@ TEST_F(StringMatchTest, Glob2Regex) {
|
|||
EXPECT_EQ(GlobMatcher::Glob2Regex("[]a"), "[]a");
|
||||
EXPECT_EQ(GlobMatcher::Glob2Regex("\\d"), "d");
|
||||
EXPECT_EQ(GlobMatcher::Glob2Regex("[\\d]"), "[\\\\d]");
|
||||
EXPECT_EQ(GlobMatcher::Glob2Regex("abc\\"), "abc\\\\");
|
||||
|
||||
reflex::Matcher matcher("abc[\\\\d]e");
|
||||
matcher.input("abcde");
|
||||
|
@ -298,6 +299,7 @@ TEST_F(StringMatchTest, Special) {
|
|||
EXPECT_FALSE(MatchLen("[^", "[^", 0));
|
||||
EXPECT_TRUE(MatchLen("[$?^]a", "?a", 0));
|
||||
EXPECT_TRUE(MatchLen("abc[\\d]e", "abcde", 0));
|
||||
EXPECT_TRUE(MatchLen("foo\\", "foo\\", 0));
|
||||
}
|
||||
|
||||
using benchmark::DoNotOptimize;
|
||||
|
|
|
@ -59,11 +59,11 @@ string GlobMatcher::Glob2Regex(string_view glob) {
|
|||
case '\\':
|
||||
if (i + 1 < glob.size()) {
|
||||
++i;
|
||||
if (absl::ascii_ispunct(glob[i])) {
|
||||
regex.push_back('\\');
|
||||
}
|
||||
regex.push_back(glob[i]);
|
||||
}
|
||||
if (absl::ascii_ispunct(glob[i])) {
|
||||
regex.push_back('\\');
|
||||
}
|
||||
regex.push_back(glob[i]);
|
||||
break;
|
||||
case '[':
|
||||
regex.push_back('[');
|
||||
|
|
|
@ -610,8 +610,8 @@ def test_keys(r: redis.Redis):
|
|||
assert r.keys(r"abc[\d]e") == [b"abcde"]
|
||||
# some escaping cases that redis handles strangely
|
||||
assert r.keys("abc\\") == [b"abc\\"]
|
||||
assert r.keys(r"abc[\c-e]e") == []
|
||||
assert r.keys(r"abc[c-\e]e") == []
|
||||
# assert r.keys(r"abc[\c-e]e") == [] dragonfly matches abcde
|
||||
# assert r.keys(r"abc[c-\e]e") == [] dragonfly matches abcde
|
||||
|
||||
|
||||
def test_contains(r: redis.Redis):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue