aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests/serde.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-21 14:10:24 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-21 14:10:24 -0600
commit7bbbfd046324363c8db1fb15d39aeb02fe7331b5 (patch)
treea416bb991c23e083d0b5816dfc8b00cd1aceda78 /test-suite/tests/serde.rs
parentb1417006df376e6c406bff43740dd11aa7ef744e (diff)
downloadmilf-rs-main.tar.gz
milf-rs-main.zip
hilarious and original jokeHEADmain
Diffstat (limited to 'test-suite/tests/serde.rs')
-rw-r--r--test-suite/tests/serde.rs64
1 files changed, 32 insertions, 32 deletions
diff --git a/test-suite/tests/serde.rs b/test-suite/tests/serde.rs
index 56172bd..712d2c5 100644
--- a/test-suite/tests/serde.rs
+++ b/test-suite/tests/serde.rs
@@ -1,15 +1,15 @@
extern crate serde;
extern crate serde_json;
-extern crate toml;
+extern crate milf;
#[macro_use]
extern crate serde_derive;
use serde::{Deserialize, Deserializer};
use std::collections::{BTreeMap, HashSet};
-use toml::map::Map;
-use toml::Value;
-use toml::Value::{Array, Float, Integer, Table};
+use milf::map::Map;
+use milf::Value;
+use milf::Value::{Array, Float, Integer, Table};
macro_rules! t {
($e:expr) => {
@@ -21,38 +21,38 @@ macro_rules! t {
}
macro_rules! equivalent {
- ($literal:expr, $toml:expr,) => {{
- let toml = $toml;
+ ($literal:expr, $milf:expr,) => {{
+ let milf = $milf;
let literal = $literal;
// In/out of Value is equivalent
println!("try_from");
- assert_eq!(t!(Value::try_from(literal.clone())), toml);
+ assert_eq!(t!(Value::try_from(literal.clone())), milf);
println!("try_into");
- assert_eq!(literal, t!(toml.clone().try_into()));
+ assert_eq!(literal, t!(milf.clone().try_into()));
// Through a string equivalent
println!("to_string(literal)");
- assert_eq!(t!(toml::to_string(&literal)), toml.to_string());
- println!("to_string(toml)");
- assert_eq!(t!(toml::to_string(&toml)), toml.to_string());
- println!("literal, from_str(toml)");
- assert_eq!(literal, t!(toml::from_str(&toml.to_string())));
- println!("toml, from_str(toml)");
- assert_eq!(toml, t!(toml::from_str(&toml.to_string())));
+ assert_eq!(t!(milf::to_string(&literal)), milf.to_string());
+ println!("to_string(milf)");
+ assert_eq!(t!(milf::to_string(&milf)), milf.to_string());
+ println!("literal, from_str(milf)");
+ assert_eq!(literal, t!(milf::from_str(&milf.to_string())));
+ println!("milf, from_str(milf)");
+ assert_eq!(milf, t!(milf::from_str(&milf.to_string())));
}};
}
macro_rules! error {
- ($ty:ty, $toml:expr, $msg_parse:expr, $msg_decode:expr) => {{
+ ($ty:ty, $milf:expr, $msg_parse:expr, $msg_decode:expr) => {{
println!("attempting parsing");
- match toml::from_str::<$ty>(&$toml.to_string()) {
+ match milf::from_str::<$ty>(&$milf.to_string()) {
Ok(_) => panic!("successful"),
Err(e) => assert_eq!(e.to_string(), $msg_parse),
}
- println!("attempting toml decoding");
- match $toml.try_into::<$ty>() {
+ println!("attempting milf decoding");
+ match $milf.try_into::<$ty>() {
Ok(_) => panic!("successful"),
Err(e) => assert_eq!(e.to_string(), $msg_decode),
}
@@ -376,7 +376,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, Some(Table(map! {
+// assert_eq!(d.milf, Some(Table(map! {
// b, Integer(5)
// })));
// }
@@ -397,7 +397,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, Some(Table(map! {
+// assert_eq!(d.milf, Some(Table(map! {
// a, Table(map! {
// b, Integer(5)
// })
@@ -419,7 +419,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, None);
+// assert_eq!(d.milf, None);
// }
//
// #[test]
@@ -435,7 +435,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, None);
+// assert_eq!(d.milf, None);
// }
//
// #[test]
@@ -449,7 +449,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, None);
+// assert_eq!(d.milf, None);
// }
//
// #[test]
@@ -463,7 +463,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, None);
+// assert_eq!(d.milf, None);
// }
//
// #[test]
@@ -482,7 +482,7 @@ fn parse_enum_string() {
// }));
// assert_eq!(v, t!(Deserialize::deserialize(&mut d)));
//
-// assert_eq!(d.toml, Some(Table(map! {
+// assert_eq!(d.milf, Some(Table(map! {
// a, Array(vec![Table(map! {
// b, Integer(2)
// })])
@@ -531,9 +531,9 @@ fn extra_keys() {
a: isize,
}
- let toml = Table(map! { a: Integer(2), b: Integer(2) });
- assert!(toml.clone().try_into::<Foo>().is_ok());
- assert!(toml::from_str::<Foo>(&toml.to_string()).is_ok());
+ let milf = Table(map! { a: Integer(2), b: Integer(2) });
+ assert!(milf.clone().try_into::<Foo>().is_ok());
+ assert!(milf::from_str::<Foo>(&milf.to_string()).is_ok());
}
#[test]
@@ -590,7 +590,7 @@ struct CanBeEmpty {
#[test]
fn table_structs_empty() {
let text = "[bar]\n\n[baz]\n\n[bazv]\na = \"foo\"\n\n[foo]\n";
- let value: BTreeMap<String, CanBeEmpty> = toml::from_str(text).unwrap();
+ let value: BTreeMap<String, CanBeEmpty> = milf::from_str(text).unwrap();
let mut expected: BTreeMap<String, CanBeEmpty> = BTreeMap::new();
expected.insert("bar".to_string(), CanBeEmpty::default());
expected.insert("baz".to_string(), CanBeEmpty::default());
@@ -603,7 +603,7 @@ fn table_structs_empty() {
);
expected.insert("foo".to_string(), CanBeEmpty::default());
assert_eq!(value, expected);
- assert_eq!(toml::to_string(&value).unwrap(), text);
+ assert_eq!(milf::to_string(&value).unwrap(), text);
}
#[test]
@@ -671,7 +671,7 @@ fn homogeneous_tuple_struct() {
fn json_interoperability() {
#[derive(Serialize, Deserialize)]
struct Foo {
- any: toml::Value,
+ any: milf::Value,
}
let _foo: Foo = serde_json::from_str(