get segments from borrowed str instead of String for flexibility
This commit is contained in:
parent
46f8831c7b
commit
e992e41635
|
@ -125,7 +125,7 @@ impl Game {
|
|||
}
|
||||
|
||||
let string = string.trim_start_matches('\n').to_string();
|
||||
let mut segments = segments_from_string(string);
|
||||
let mut segments = segments_from_str(&string);
|
||||
|
||||
let mut name = "".to_string();
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ impl Unquote for String {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::{ToBase36, optional_data_line, mock, segments_from_string, Quote, Unquote, new_unique_id, try_id};
|
||||
use crate::{ToBase36, optional_data_line, mock, segments_from_str, Quote, Unquote, new_unique_id, try_id};
|
||||
|
||||
#[test]
|
||||
fn to_base36() {
|
||||
|
@ -202,9 +202,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn string_to_segments() {
|
||||
let output = segments_from_string(
|
||||
include_str!("./test-resources/segments").to_string()
|
||||
);
|
||||
let output = segments_from_str(include_str!("./test-resources/segments"));
|
||||
|
||||
let expected = vec![
|
||||
"\"\"\"\nthe first segment is a long bit of text\n\n\nit contains empty lines\n\n\"\"\"".to_string(),
|
||||
|
|
Loading…
Reference in New Issue