Add a snippet unit test with an escaped curly brace

This commit is contained in:
Max Brunsfeld 2022-03-11 13:02:20 -08:00
parent 7a68b2d371
commit a137abe2de

View File

@ -189,10 +189,14 @@ mod tests {
}
#[test]
fn test_snippet_parsing_with_escaped_dollar_sign() {
fn test_snippet_parsing_with_escaped_chars() {
let snippet = Snippet::parse("\"\\$schema\": $1").unwrap();
assert_eq!(snippet.text, "\"$schema\": ");
assert_eq!(tabstops(&snippet), &[vec![11..11]]);
let snippet = Snippet::parse("{a\\}").unwrap();
assert_eq!(snippet.text, "{a}");
assert_eq!(tabstops(&snippet), &[vec![3..3]]);
}
fn tabstops(snippet: &Snippet) -> Vec<Vec<Range<isize>>> {