From a137abe2de5663d01a5e6c9332ed2b5d46b2800e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 11 Mar 2022 13:02:20 -0800 Subject: [PATCH] Add a snippet unit test with an escaped curly brace --- crates/snippet/src/snippet.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/snippet/src/snippet.rs b/crates/snippet/src/snippet.rs index ecd3436527..8f4ca82c05 100644 --- a/crates/snippet/src/snippet.rs +++ b/crates/snippet/src/snippet.rs @@ -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>> {