diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-10-02 19:15:47 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-10-02 20:40:17 +0200 |
commit | 3ecc24a33f1fda8945fbdd39fb822fe7e8b25aeb (patch) | |
tree | a98c74714cdeb94a3ad62fc57a6223359cccd0ee | |
parent | 1f06a0f2067f35bfcba473635be033cc27fb7db9 (diff) |
Rewrite test with TOML, as module is only compiled with "toml" feature enabled
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | tests/errors.rs | 12 | ||||
-rw-r--r-- | tests/legacy/errors.rs | 13 |
2 files changed, 9 insertions, 16 deletions
diff --git a/tests/errors.rs b/tests/errors.rs index 60f1121..856da4f 100644 --- a/tests/errors.rs +++ b/tests/errors.rs @@ -117,21 +117,17 @@ fn error_with_path() { inner: Inner, } const CFG: &str = r#" -inner: - test: ABC -"#; + inner.test = "ABC" + "#; let e = Config::builder() - .add_source(File::from_str(CFG, FileFormat::Yaml)) + .add_source(File::from_str(CFG, FileFormat::Toml)) .build() .unwrap() .try_into::<Outer>() .unwrap_err(); - if let ConfigError::Type { - key: Some(path), .. - } = e - { + if let ConfigError::Type { key: Some(path), .. } = e { assert_eq!(path, "inner.test"); } else { panic!("Wrong error {:?}", e); diff --git a/tests/legacy/errors.rs b/tests/legacy/errors.rs index c0ce234..5ded0a8 100644 --- a/tests/legacy/errors.rs +++ b/tests/legacy/errors.rs @@ -113,18 +113,15 @@ fn error_with_path() { struct Outer { inner: Inner, } + const CFG: &str = r#" -inner: - test: ABC -"#; + inner.test = "ABC" + "#; let mut cfg = Config::default(); - cfg.merge(File::from_str(CFG, FileFormat::Yaml)).unwrap(); + cfg.merge(File::from_str(CFG, FileFormat::Toml)).unwrap(); let e = cfg.try_into::<Outer>().unwrap_err(); - if let ConfigError::Type { - key: Some(path), .. - } = e - { + if let ConfigError::Type { key: Some(path), .. } = e { assert_eq!(path, "inner.test"); } else { panic!("Wrong error {:?}", e); |