Repository: ron-rs/ron
Pull request #369 (2022-02-24 12:39:15)

Increased coverage for unit tests
~~* [ ] I've included my change in `CHANGELOG.md`~~



Patch:
diff --git a/src/de/value.rs b/src/de/value.rs
index 041c16f9..544ee05e 100644
--- a/src/de/value.rs
+++ b/src/de/value.rs
@@ -9,7 +9,7 @@ use crate::error::SpannedResult;
 use crate::value::{Map, Number, Value};
 
 impl std::str::FromStr for Value {
-    type Err = crate::SpannedError;
+    type Err = crate::error::SpannedError;
 
     /// Creates a value from a string reference.
     fn from_str(s: &str) -> SpannedResult<Self> {
diff --git a/src/lib.rs b/src/lib.rs
index 0be42340..1e768a1b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -70,7 +70,7 @@ pub mod extensions;
 pub mod options;
 
 pub use de::{from_str, Deserializer};
-pub use error::{Result, SpannedError};
+pub use error::{Error, Result};
 pub use options::Options;
 pub use ser::{to_string, Serializer};
 pub use value::{Map, Number, Value};


Test patch:
diff --git a/tests/129_indexmap.rs b/tests/129_indexmap.rs
index ccaaaef9..7fae9935 100644
--- a/tests/129_indexmap.rs
+++ b/tests/129_indexmap.rs
@@ -34,9 +34,9 @@ tasks: {
                     Value::String("shell command".to_string())
                 );
             }
-            _ => panic!(),
+            _ => panic!(), // GRCOV_EXCL_LINE
         },
-        _ => panic!(),
+        _ => panic!(), // GRCOV_EXCL_LINE
     }
 
     let file = r#"(
@@ -69,8 +69,8 @@ tasks: {
                     Value::String("debug message".to_string())
                 );
             }
-            _ => panic!(),
+            _ => panic!(), // GRCOV_EXCL_LINE
         },
-        _ => panic!(),
+        _ => panic!(), // GRCOV_EXCL_LINE
     }
 }
diff --git a/tests/147_empty_sets_serialisation.rs b/tests/147_empty_sets_serialisation.rs
index a3fab462..81cabf64 100644
--- a/tests/147_empty_sets_serialisation.rs
+++ b/tests/147_empty_sets_serialisation.rs
@@ -13,20 +13,13 @@ struct TupleStruct(UnitStruct, i8);
 #[derive(Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
 struct Key(u32);
 
-#[derive(Debug, PartialEq, Eq, Hash, Deserialize, Serialize)]
-enum Enum {
-    Unit,
-    Bool(bool),
-    Chars(char, String),
-}
-
 #[derive(Debug, PartialEq, Deserialize, Serialize)]
 struct Struct {
     tuple: ((), NewType, TupleStruct),
     vec: Vec<Option<UnitStruct>>,
-    map: HashMap<Key, Enum>,
+    map: HashMap<Key, i32>,
     deep_vec: HashMap<Key, Vec<()>>,
-    deep_map: HashMap<Key, HashMap<Key, Enum>>,
+    deep_map: HashMap<Key, HashMap<Key, i32>>,
 }
 
 #[test]
diff --git a/tests/359_deserialize_seed.rs b/tests/359_deserialize_seed.rs
index c193a7c1..74afd05a 100644
--- a/tests/359_deserialize_seed.rs
+++ b/tests/359_deserialize_seed.rs
@@ -43,4 +43,14 @@ fn test_deserialize_seed() {
 
         assert_eq!(expected, deserialized);
     }
+
+    assert_eq!(
+        ron::Options::default().from_str_seed("'a'", Seed(42)),
+        Err(ron::error::SpannedError {
+            code: ron::Error::Message(String::from(
+                "invalid type: string \"a\", expected an integer"
+            )),
+            position: ron::error::Position { line: 1, col: 4 },
+        })
+    );
 }
diff --git a/tests/preserve_sequence.rs b/tests/preserve_sequence.rs
index 9bb1d489..8ffb20d8 100644
--- a/tests/preserve_sequence.rs
+++ b/tests/preserve_sequence.rs
@@ -25,13 +25,7 @@ fn read_original(source: &str) -> String {
 }
 
 fn make_roundtrip(source: &str) -> String {
-    let config: Config = match from_str(source) {
-        Ok(x) => x,
-        Err(e) => {
-            println!("Failed to load config: {}", e);
-            std::process::exit(1);
-        }
-    };
+    let config: Config = from_str(source).unwrap();
     let pretty = PrettyConfig::new()
         .depth_limit(3)
         .separate_tuple_members(true)