summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-09-17 16:17:28 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-09-17 16:17:28 -0300
commitf17c00795f9b1fc1a7e0c636478e13d66fda737c (patch)
tree1bdd38fa760c0da944ef2fe8964de782ed7f7267 /tests
parent134727652dc3a65bc5cf6a4d3cfb1c24fd023d5e (diff)
Tweak MayBe to better align with Datafu
This is a breaking change, but aligning with Datafu is useful.
Diffstat (limited to 'tests')
-rw-r--r--tests/maybe.rs13
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());
 }