String can be compared to &str
This commit is contained in:
parent
22c41fb032
commit
eede24b13c
10
src/lib.rs
10
src/lib.rs
|
@ -194,7 +194,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_optional_data_line() {
|
fn test_optional_data_line() {
|
||||||
let output = optional_data_line("NAME", mock::item().name);
|
let output = optional_data_line("NAME", mock::item().name);
|
||||||
assert_eq!(output, "\nNAME door".to_string());
|
assert_eq!(output, "\nNAME door");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -216,14 +216,14 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn quote() {
|
fn quote() {
|
||||||
let output = "this is a string.\nIt has 2 lines".to_string().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();
|
let expected = "\"\"\"\nthis is a string.\nIt has 2 lines\n\"\"\"";
|
||||||
assert_eq!(output, expected);
|
assert_eq!(output, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unquote() {
|
fn 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 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();
|
let expected = "who the fuck is scraeming \"LOG OFF\" at my house.\nshow yourself, coward.\ni will never log off";
|
||||||
assert_eq!(output, expected);
|
assert_eq!(output, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,12 +232,12 @@ mod test {
|
||||||
// does a conflict generate a new ID?
|
// does a conflict generate a new ID?
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
try_id(&vec!["0".to_string(), "1".to_string()], &"1".to_string()),
|
try_id(&vec!["0".to_string(), "1".to_string()], &"1".to_string()),
|
||||||
"2".to_string()
|
"2"
|
||||||
);
|
);
|
||||||
// with no conflict, does the ID remain the same?
|
// with no conflict, does the ID remain the same?
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
try_id(&vec!["0".to_string(), "1".to_string()], &"3".to_string()),
|
try_id(&vec!["0".to_string(), "1".to_string()], &"3".to_string()),
|
||||||
"3".to_string()
|
"3"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue