diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-21 14:10:24 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-21 14:10:24 -0600 |
commit | 7bbbfd046324363c8db1fb15d39aeb02fe7331b5 (patch) | |
tree | a416bb991c23e083d0b5816dfc8b00cd1aceda78 /test-suite/tests/pretty.rs | |
parent | b1417006df376e6c406bff43740dd11aa7ef744e (diff) | |
download | milf-rs-main.tar.gz milf-rs-main.zip |
Diffstat (limited to 'test-suite/tests/pretty.rs')
-rw-r--r-- | test-suite/tests/pretty.rs | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/test-suite/tests/pretty.rs b/test-suite/tests/pretty.rs index 0c65e0f..ee9f4f8 100644 --- a/test-suite/tests/pretty.rs +++ b/test-suite/tests/pretty.rs @@ -1,5 +1,5 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::ser::Serialize; @@ -13,31 +13,31 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] fn no_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } #[test] fn disable_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); serializer.pretty_array(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_STD: &'static str = "\ @@ -57,15 +57,15 @@ this is the second line #[test] fn pretty_std() { - let toml = PRETTY_STD; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_STD; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2: &'static str = "\ @@ -90,16 +90,16 @@ three = [ #[test] fn pretty_indent_2() { - let toml = PRETTY_INDENT_2; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } println!(">> Result:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2_OTHER: &'static str = "\ @@ -116,15 +116,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_2_other() { - let toml = PRETTY_INDENT_2_OTHER; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2_OTHER; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_ARRAY_NO_COMMA: &'static str = "\ @@ -140,15 +140,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_array_no_comma() { - let toml = PRETTY_ARRAY_NO_COMMA; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_ARRAY_NO_COMMA; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_trailing_comma(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_NO_STRING: &'static str = "\ @@ -164,15 +164,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_no_string() { - let toml = PRETTY_NO_STRING; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_NO_STRING; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY: &'static str = r##"[example] @@ -204,15 +204,15 @@ this is the fourth line #[test] fn pretty_tricky() { - let toml = PRETTY_TRICKY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TABLE_ARRAY: &'static str = r##"[[array]] @@ -230,15 +230,15 @@ single = 'this is a single line string' #[test] fn pretty_table_array() { - let toml = PRETTY_TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const TABLE_ARRAY: &'static str = r##"[[array]] @@ -256,15 +256,15 @@ single = "this is a single line string" #[test] fn table_array() { - let toml = TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY_NON_LITERAL: &'static str = r##"[example] @@ -300,15 +300,15 @@ this is the fourth line #[test] fn pretty_tricky_non_literal() { - let toml = PRETTY_TRICKY_NON_LITERAL; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY_NON_LITERAL; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string_literal(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } |