Fix tests that were supposed to escape characters

This commit is contained in:
Kerollmops 2023-09-06 11:39:36 +02:00
parent b42d48187a
commit ea78060916
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -318,17 +318,17 @@ pub mod test {
("\"cha'nnel\"", "cha'nnel", false), ("\"cha'nnel\"", "cha'nnel", false),
("I'm tamo", "I", false), ("I'm tamo", "I", false),
// escaped thing but not quote // escaped thing but not quote
(r#""\\""#, r#"\\"#, false), (r#""\\""#, r#"\"#, true),
(r#""\\\\\\""#, r#"\\\\\\"#, false), (r#""\\\\\\""#, r#"\\\"#, true),
(r#""aa\\aa""#, r#"aa\\aa"#, false), (r#""aa\\aa""#, r#"aa\aa"#, true),
// with double quote // with double quote
(r#""Hello \"world\"""#, r#"Hello "world""#, true), (r#""Hello \"world\"""#, r#"Hello "world""#, true),
(r#""Hello \\\"world\\\"""#, r#"Hello \\"world\\""#, true), (r#""Hello \\\"world\\\"""#, r#"Hello \"world\""#, true),
(r#""I'm \"super\" tamo""#, r#"I'm "super" tamo"#, true), (r#""I'm \"super\" tamo""#, r#"I'm "super" tamo"#, true),
(r#""\"\"""#, r#""""#, true), (r#""\"\"""#, r#""""#, true),
// with simple quote // with simple quote
(r#"'Hello \'world\''"#, r#"Hello 'world'"#, true), (r#"'Hello \'world\''"#, r#"Hello 'world'"#, true),
(r#"'Hello \\\'world\\\''"#, r#"Hello \\'world\\'"#, true), (r#"'Hello \\\'world\\\''"#, r#"Hello \'world\'"#, true),
(r#"'I\'m "super" tamo'"#, r#"I'm "super" tamo"#, true), (r#"'I\'m "super" tamo'"#, r#"I'm "super" tamo"#, true),
(r#"'\'\''"#, r#"''"#, true), (r#"'\'\''"#, r#"''"#, true),
]; ];
@ -350,7 +350,14 @@ pub mod test {
"Filter `{}` was not supposed to be escaped", "Filter `{}` was not supposed to be escaped",
input input
); );
assert_eq!(token.value(), expected, "Filter `{}` failed.", input); assert_eq!(
token.value(),
expected,
"Filter `{}` failed by giving `{}` instead of `{}`.",
input,
token.value(),
expected
);
} }
} }