summaryrefslogtreecommitdiffstats
path: root/tests/file_ini.rs
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2018-07-02 15:33:38 -0700
committerRyan Leckey <leckey.ryan@gmail.com>2018-07-02 15:33:38 -0700
commitcbb9ef88ea6f6452614dd8bbffce7203b1358a55 (patch)
treefd4f67587f9a36c517a3a3f1ff7ef727697d5fef /tests/file_ini.rs
parentbbc78d85610dec79aa4af4dd360131c7880efb5f (diff)
Run rustfmt (nightly)
Diffstat (limited to 'tests/file_ini.rs')
-rw-r--r--tests/file_ini.rs123
1 files changed, 63 insertions, 60 deletions
diff --git a/tests/file_ini.rs b/tests/file_ini.rs
index 4c0030a..30d86a3 100644
--- a/tests/file_ini.rs
+++ b/tests/file_ini.rs
@@ -1,60 +1,63 @@
-extern crate config;
-extern crate serde;
-extern crate float_cmp;
-
-#[macro_use]
-extern crate serde_derive;
-
-use config::*;
-
-#[derive(Debug, Deserialize, PartialEq)]
-struct Place {
- name: String,
- longitude: f64,
- latitude: f64,
- favorite: bool,
- reviews: u64,
- rating: Option<f32>,
-}
-
-#[derive(Debug, Deserialize, PartialEq)]
-struct Settings {
- debug: f64,
- place: Place,
-}
-
-fn make() -> Config {
- let mut c = Config::default();
- c.merge(File::new("tests/Settings", FileFormat::Ini))
- .unwrap();
- c
-}
-
-#[test]
-fn test_file() {
- let c = make();
- let s: Settings = c.try_into().unwrap();
- assert_eq!(s, Settings {
- debug: 1.0,
- place: Place {
- name: String::from("Torre di Pisa"),
- longitude: 43.7224985,
- latitude: 10.3970522,
- favorite: false,
- reviews: 3866,
- rating: Some(4.5),
- },
- });
-}
-
-#[test]
-fn test_error_parse() {
- let mut c = Config::default();
- let res = c.merge(File::new("tests/Settings-invalid", FileFormat::Ini));
-
- assert!(res.is_err());
- assert_eq!(
- res.unwrap_err().to_string(),
- r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in tests/Settings-invalid.ini"#
- );
-}
+extern crate config;
+extern crate float_cmp;
+extern crate serde;
+
+#[macro_use]
+extern crate serde_derive;
+
+use config::*;
+
+#[derive(Debug, Deserialize, PartialEq)]
+struct Place {
+ name: String,
+ longitude: f64,
+ latitude: f64,
+ favorite: bool,
+ reviews: u64,
+ rating: Option<f32>,
+}
+
+#[derive(Debug, Deserialize, PartialEq)]
+struct Settings {
+ debug: f64,
+ place: Place,
+}
+
+fn make() -> Config {
+ let mut c = Config::default();
+ c.merge(File::new("tests/Settings", FileFormat::Ini))
+ .unwrap();
+ c
+}
+
+#[test]
+fn test_file() {
+ let c = make();
+ let s: Settings = c.try_into().unwrap();
+ assert_eq!(
+ s,
+ Settings {
+ debug: 1.0,
+ place: Place {
+ name: String::from("Torre di Pisa"),
+ longitude: 43.7224985,
+ latitude: 10.3970522,
+ favorite: false,
+ reviews: 3866,
+ rating: Some(4.5),
+ },
+ }
+ );
+}
+
+#[test]
+fn test_error_parse() {
+ let mut c = Config::default();
+ let res = c.merge(File::new("tests/Settings-invalid", FileFormat::Ini));
+
+ assert!(res.is_err());
+ assert_eq!(
+ res.unwrap_err().to_string(),
+ r#"2:0 Expecting "[Some('='), Some(':')]" but found EOF. in tests/Settings-invalid.ini"#
+ );
+}