Skip to content

Commit 62898ee

Browse files
committed
Add red tests reproducing #4839
1 parent c9f721c commit 62898ee

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

RubberduckTests/RegexAssistant/CharacterClassTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,25 @@ public void IgnoresBackreferenceSpecifiers()
210210
Assert.AreEqual(expectedSpecifiers[i], cut.CharacterSpecifiers[i]);
211211
}
212212
}
213+
214+
[Test]
215+
// https://github.com/rubberduck-vba/Rubberduck/issues/4839
216+
public void TrailingEscapedBackslash()
217+
{
218+
const string pattern = @"[^\w\\]";
219+
220+
var expression = VBRegexParser.Parse(pattern);
221+
Assert.IsInstanceOf(typeof(SingleAtomExpression), expression);
222+
var atom = (expression as SingleAtomExpression).Atom;
223+
Assert.AreEqual(new CharacterClass(@"[^\w\\]", Quantifier.None), atom);
224+
}
225+
226+
[Test]
227+
// https://github.com/rubberduck-vba/Rubberduck/issues/4839
228+
public void TrailingEscapedBackslashIsConstructible()
229+
{
230+
const string pattern = @"[^\w\\]";
231+
new CharacterClass(pattern, Quantifier.None);
232+
}
213233
}
214234
}

0 commit comments

Comments
 (0)