aboutsummaryrefslogtreecommitdiff
path: root/tests
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 /tests
parentb1417006df376e6c406bff43740dd11aa7ef744e (diff)
downloadmilf-rs-7bbbfd046324363c8db1fb15d39aeb02fe7331b5.tar.gz
milf-rs-7bbbfd046324363c8db1fb15d39aeb02fe7331b5.zip
hilarious and original jokeHEADmain
Diffstat (limited to 'tests')
-rw-r--r--tests/enum_external_deserialize.rs48
1 files changed, 24 insertions, 24 deletions
diff --git a/tests/enum_external_deserialize.rs b/tests/enum_external_deserialize.rs
index 6d45b48..6bed586 100644
--- a/tests/enum_external_deserialize.rs
+++ b/tests/enum_external_deserialize.rs
@@ -1,6 +1,6 @@
#[macro_use]
extern crate serde_derive;
-extern crate toml;
+extern crate milf;
#[derive(Debug, Deserialize, PartialEq)]
struct OuterStruct {
@@ -27,7 +27,7 @@ struct Multi {
#[test]
fn invalid_variant_returns_error_with_good_message_string() {
- let error = toml::from_str::<TheEnum>("\"NonExistent\"").unwrap_err();
+ let error = milf::from_str::<TheEnum>("\"NonExistent\"").unwrap_err();
assert_eq!(
error.to_string(),
@@ -37,7 +37,7 @@ fn invalid_variant_returns_error_with_good_message_string() {
#[test]
fn invalid_variant_returns_error_with_good_message_inline_table() {
- let error = toml::from_str::<TheEnum>("{ NonExistent = {} }").unwrap_err();
+ let error = milf::from_str::<TheEnum>("{ NonExistent = {} }").unwrap_err();
assert_eq!(
error.to_string(),
"unknown variant `NonExistent`, expected one of `Plain`, `Tuple`, `NewType`, `Struct`"
@@ -46,14 +46,14 @@ fn invalid_variant_returns_error_with_good_message_inline_table() {
#[test]
fn extra_field_returns_expected_empty_table_error() {
- let error = toml::from_str::<TheEnum>("{ Plain = { extra_field = 404 } }").unwrap_err();
+ let error = milf::from_str::<TheEnum>("{ Plain = { extra_field = 404 } }").unwrap_err();
assert_eq!(error.to_string(), "expected empty table");
}
#[test]
fn extra_field_returns_expected_empty_table_error_struct_variant() {
- let error = toml::from_str::<TheEnum>("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }")
+ let error = milf::from_str::<TheEnum>("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }")
.unwrap_err();
assert_eq!(
@@ -67,23 +67,23 @@ mod enum_unit {
#[test]
fn from_str() {
- assert_eq!(TheEnum::Plain, toml::from_str("\"Plain\"").unwrap());
+ assert_eq!(TheEnum::Plain, milf::from_str("\"Plain\"").unwrap());
}
#[test]
fn from_inline_table() {
- assert_eq!(TheEnum::Plain, toml::from_str("{ Plain = {} }").unwrap());
+ assert_eq!(TheEnum::Plain, milf::from_str("{ Plain = {} }").unwrap());
assert_eq!(
Val {
val: TheEnum::Plain
},
- toml::from_str("val = { Plain = {} }").unwrap()
+ milf::from_str("val = { Plain = {} }").unwrap()
);
}
#[test]
fn from_dotted_table() {
- assert_eq!(TheEnum::Plain, toml::from_str("[Plain]\n").unwrap());
+ assert_eq!(TheEnum::Plain, milf::from_str("[Plain]\n").unwrap());
}
}
@@ -94,13 +94,13 @@ mod enum_tuple {
fn from_inline_table() {
assert_eq!(
TheEnum::Tuple(-123, true),
- toml::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap()
+ milf::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap()
);
assert_eq!(
Val {
val: TheEnum::Tuple(-123, true)
},
- toml::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap()
+ milf::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap()
);
}
@@ -108,7 +108,7 @@ mod enum_tuple {
fn from_dotted_table() {
assert_eq!(
TheEnum::Tuple(-123, true),
- toml::from_str(
+ milf::from_str(
r#"[Tuple]
0 = -123
1 = true
@@ -126,13 +126,13 @@ mod enum_newtype {
fn from_inline_table() {
assert_eq!(
TheEnum::NewType("value".to_string()),
- toml::from_str(r#"{ NewType = "value" }"#).unwrap()
+ milf::from_str(r#"{ NewType = "value" }"#).unwrap()
);
assert_eq!(
Val {
val: TheEnum::NewType("value".to_string()),
},
- toml::from_str(r#"val = { NewType = "value" }"#).unwrap()
+ milf::from_str(r#"val = { NewType = "value" }"#).unwrap()
);
}
@@ -141,13 +141,13 @@ mod enum_newtype {
fn from_dotted_table() {
assert_eq!(
TheEnum::NewType("value".to_string()),
- toml::from_str(r#"NewType = "value""#).unwrap()
+ milf::from_str(r#"NewType = "value""#).unwrap()
);
assert_eq!(
Val {
val: TheEnum::NewType("value".to_string()),
},
- toml::from_str(
+ milf::from_str(
r#"[val]
NewType = "value"
"#
@@ -164,13 +164,13 @@ mod enum_struct {
fn from_inline_table() {
assert_eq!(
TheEnum::Struct { value: -123 },
- toml::from_str("{ Struct = { value = -123 } }").unwrap()
+ milf::from_str("{ Struct = { value = -123 } }").unwrap()
);
assert_eq!(
Val {
val: TheEnum::Struct { value: -123 }
},
- toml::from_str("val = { Struct = { value = -123 } }").unwrap()
+ milf::from_str("val = { Struct = { value = -123 } }").unwrap()
);
}
@@ -178,7 +178,7 @@ mod enum_struct {
fn from_dotted_table() {
assert_eq!(
TheEnum::Struct { value: -123 },
- toml::from_str(
+ milf::from_str(
r#"[Struct]
value = -123
"#
@@ -193,7 +193,7 @@ mod enum_struct {
OuterStruct {
inner: TheEnum::Struct { value: -123 }
},
- toml::from_str(
+ milf::from_str(
r#"[inner.Struct]
value = -123
"#
@@ -208,7 +208,7 @@ mod enum_array {
#[test]
fn from_inline_tables() {
- let toml_str = r#"
+ let milf_str = r#"
enums = [
{ Plain = {} },
{ Tuple = { 0 = -123, 1 = true } },
@@ -224,14 +224,14 @@ mod enum_array {
TheEnum::Struct { value: -123 },
]
},
- toml::from_str(toml_str).unwrap()
+ milf::from_str(milf_str).unwrap()
);
}
#[test]
#[ignore = "Unimplemented: https://github.com/alexcrichton/toml-rs/pull/264#issuecomment-431707209"]
fn from_dotted_table() {
- let toml_str = r#"[[enums]]
+ let milf_str = r#"[[enums]]
Plain = {}
[[enums]]
@@ -252,7 +252,7 @@ mod enum_array {
TheEnum::Struct { value: -123 },
]
},
- toml::from_str(toml_str).unwrap()
+ milf::from_str(milf_str).unwrap()
);
}
}