Support back-tick at EOL for literal strings.

This commit is contained in:
Stephen Chung
2021-03-30 13:59:27 +08:00
parent d756b7bac6
commit e36e490a30
3 changed files with 43 additions and 10 deletions

View File

@@ -8,6 +8,10 @@ fn test_string() -> Result<(), Box<EvalAltResult>> {
engine.eval::<String>(r#""Test string: \u2764""#)?,
"Test string: ❤"
);
assert_eq!(
engine.eval::<String>("\"Test\rstring: \\u2764\"")?,
"Test\rstring: ❤"
);
assert_eq!(
engine.eval::<String>(" \"Test string: \\u2764\\\n hello, world!\"")?,
"Test string: ❤ hello, world!"
@@ -16,6 +20,14 @@ fn test_string() -> Result<(), Box<EvalAltResult>> {
engine.eval::<String>(" `Test string: \\u2764\nhello,\\nworld!`")?,
"Test string: \\u2764\nhello,\\nworld!"
);
assert_eq!(
engine.eval::<String>(" `\nTest string: \\u2764\nhello,\\nworld!`")?,
"Test string: \\u2764\nhello,\\nworld!"
);
assert_eq!(
engine.eval::<String>(" `\r\nTest string: \\u2764\nhello,\\nworld!`")?,
"Test string: \\u2764\nhello,\\nworld!"
);
assert_eq!(
engine.eval::<String>(r#""Test string: \x58""#)?,
"Test string: X"