Adapt tests
This commit is contained in:
parent
2c5d61c456
commit
78e104706f
1 changed files with 9 additions and 11 deletions
|
@ -51,36 +51,34 @@ impl IntoKeyValue<String, String> for String {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::split_into_key_value;
|
use super::{KeyValue, IntoKeyValue};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_single_quoted() {
|
fn test_single_quoted() {
|
||||||
let s = String::from("foo='bar'");
|
let s = String::from("foo='bar'").into_kv().unwrap();
|
||||||
assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
|
assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_double_quoted() {
|
fn test_double_quoted() {
|
||||||
let s = String::from("foo=\"bar\"");
|
let s = String::from("foo=\"bar\"").into_kv().unwrap();
|
||||||
assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
|
assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_double_and_single_quoted() {
|
fn test_double_and_single_quoted() {
|
||||||
let s = String::from("foo=\"bar\'");
|
assert!(String::from("foo=\"bar\'").into_kv().is_none());
|
||||||
assert!(split_into_key_value(s).is_none());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_single_and_double_quoted() {
|
fn test_single_and_double_quoted() {
|
||||||
let s = String::from("foo=\'bar\"");
|
assert!(String::from("foo=\'bar\"").into_kv().is_none());
|
||||||
assert!(split_into_key_value(s).is_none());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_not_quoted() {
|
fn test_not_quoted() {
|
||||||
let s = String::from("foo=bar");
|
let s = String::from("foo=bar").into_kv().unwrap();
|
||||||
assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
|
assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue