quote/unquote functions
This commit is contained in:
parent
e9f1a1afcf
commit
32a369118c
|
@ -62,7 +62,6 @@ some more practical uses would be things like:
|
|||
* implement Result return types on ::from functions so we can handle errors
|
||||
* handle old out-of-bounds editor errors (extra image pixels, exits/endings with position -1,-0 etc.)
|
||||
* it's ok if the output of these does not match the input as we're fixing it
|
||||
* "unquote" function for dialogues, game title, anything else that supports """
|
||||
* add Bitsy HD and Bitsy 7.0 test data
|
||||
* fix variables/endings becoming "DLG DLG"?
|
||||
* replace Image with Vec<u8> or something. seems like a pointless abstraction
|
||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue