summaryrefslogtreecommitdiffstats
path: root/libimagutil
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-01-20 10:42:40 +0100
committerMatthias Beyer <mail@beyermatthias.de>2016-01-20 10:42:40 +0100
commit78e104706f03bf4a2475b6b9dda083bf06a95282 (patch)
treea197221e8ac7351302e75cb7239554f51a8ed885 /libimagutil
parent2c5d61c4566ccb16189d7d817bc2a3259d37e486 (diff)
Adapt tests
Diffstat (limited to 'libimagutil')
-rw-r--r--libimagutil/src/key_value_split.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/libimagutil/src/key_value_split.rs b/libimagutil/src/key_value_split.rs
index 32fd30a9..567118bb 100644
--- a/libimagutil/src/key_value_split.rs
+++ b/libimagutil/src/key_value_split.rs
@@ -51,36 +51,34 @@ impl IntoKeyValue<String, String> for String {
#[cfg(test)]
mod test {
- use super::split_into_key_value;
+ use super::{KeyValue, IntoKeyValue};
#[test]
fn test_single_quoted() {
- let s = String::from("foo='bar'");
- assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
+ let s = String::from("foo='bar'").into_kv().unwrap();
+ assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
}
#[test]
fn test_double_quoted() {
- let s = String::from("foo=\"bar\"");
- assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
+ let s = String::from("foo=\"bar\"").into_kv().unwrap();
+ assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
}
#[test]
fn test_double_and_single_quoted() {
- let s = String::from("foo=\"bar\'");
- assert!(split_into_key_value(s).is_none());
+ assert!(String::from("foo=\"bar\'").into_kv().is_none());
}
#[test]
fn test_single_and_double_quoted() {
- let s = String::from("foo=\'bar\"");
- assert!(split_into_key_value(s).is_none());
+ assert!(String::from("foo=\'bar\"").into_kv().is_none());
}
#[test]
fn test_not_quoted() {
- let s = String::from("foo=bar");
- assert_eq!(Some((String::from("foo"), String::from("bar"))), split_into_key_value(s));
+ let s = String::from("foo=bar").into_kv().unwrap();
+ assert_eq!(KeyValue::new(String::from("foo"), String::from("bar")), s);
}
}