test: Add a test for LP quoting (#5210)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Marko Mikulicic 2022-07-26 22:08:37 +02:00 committed by GitHub
parent 727f0152d0
commit de22b6b080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -333,6 +333,26 @@ mod tests {
use super::*;
#[test]
fn test_string_escape() {
assert_eq!(
format!("\"{}\"", escape(r#"foo"#, DOUBLE_QUOTE)),
r#""foo""#
);
assert_eq!(
format!("\"{}\"", escape(r#"foo \ bar"#, DOUBLE_QUOTE)),
r#""foo \\ bar""#
);
assert_eq!(
format!("\"{}\"", escape(r#"foo " bar"#, DOUBLE_QUOTE)),
r#""foo \" bar""#
);
assert_eq!(
format!("\"{}\"", escape(r#"foo \" bar"#, DOUBLE_QUOTE)),
r#""foo \\\" bar""#
);
}
#[test]
fn test_lp_builder() {
const PLAIN: &str = "plain";