diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/maybe.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/maybe.rs b/tests/maybe.rs index 68db667..1437195 100644 --- a/tests/maybe.rs +++ b/tests/maybe.rs @@ -7,23 +7,24 @@ use serde_util::MayBe; #[test] fn test_is_t() { let json = "256"; - assert!(from_str::<MayBe<f64>>(json).unwrap().is_some()); + assert!(from_str::<MayBe<f64>>(json).unwrap().is()); } #[test] fn test_is_not_t() { let json = "{}"; - assert!(from_str::<MayBe<f64>>(json).unwrap().is_none()); + assert!(from_str::<MayBe<f64>>(json).unwrap().is_not()); } #[test] fn test_is_missing() { #[derive(Deserialize)] struct Foo { - bar: MayBe<f64>, + #[serde(rename = "bar")] + _bar: MayBe<f64>, } let json = "{}"; - assert!(from_str::<Foo>(json).unwrap().bar.is_none()); + assert!(from_str::<Foo>(json).is_err()); } #[test] @@ -33,7 +34,7 @@ fn test_t_in_struct() { bar: MayBe<f64>, } let json = "{\"bar\": 123}"; - assert!(from_str::<Foo>(json).unwrap().bar.is_some()); + assert!(from_str::<Foo>(json).unwrap().bar.is()); } @@ -44,5 +45,5 @@ fn test_not_t_in_struct() { bar: MayBe<f64>, } let json = "{\"bar\": []}"; - assert!(from_str::<Foo>(json).unwrap().bar.is_none()); + assert!(from_str::<Foo>(json).unwrap().bar.is_not()); } |