quote/unquote functions

This commit is contained in:
2020-04-30 18:54:28 +01:00
parent e9f1a1afcf
commit 32a369118c
2 changed files with 15 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ impl Unquote for String {
#[cfg(test)]
mod test {
use crate::{from_base36, ToBase36, optional_data_line, mock, segments_from_string};
use crate::{from_base36, ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote};
#[test]
fn test_from_base36() {
@@ -211,4 +211,18 @@ mod test {
assert_eq!(output, expected);
}
#[test]
fn test_quote() {
let output = "this is a string.\nIt has 2 lines".to_string().quote();
let expected = "\"\"\"\nthis is a string.\nIt has 2 lines\n\"\"\"".to_string();
assert_eq!(output, expected);
}
#[test]
fn test_unquote() {
let output = "\"\"\"\nwho the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off\n\"\"\"".to_string().unquote();
let expected = "who the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off".to_string();
assert_eq!(output, expected);
}
}