diff options
author | Ryan Leckey <ryan@launchbadge.com> | 2017-06-02 17:36:50 -0700 |
---|---|---|
committer | Ryan Leckey <ryan@launchbadge.com> | 2017-06-02 17:36:50 -0700 |
commit | 028aaf5247dd3cd184b250afdba235d683525f97 (patch) | |
tree | f63aabb0d8eb8776005408786cb9f04189fa7416 /tests/errors.rs | |
parent | bfc44c331a77d8c341c076e72df5ed0b56fbd422 (diff) |
Started playing with error tests
Diffstat (limited to 'tests/errors.rs')
-rw-r--r-- | tests/errors.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/errors.rs b/tests/errors.rs new file mode 100644 index 0000000..b69774c --- /dev/null +++ b/tests/errors.rs @@ -0,0 +1,31 @@ +extern crate config; + +use config::*; + +fn make() -> Config { + let mut c = Config::default(); + c.merge(File::new("tests/Settings", FileFormat::Toml)) + .unwrap(); + + c +} + +#[test] +fn test_error_parse() { + let mut c = Config::default(); + c.merge(File::new("tests/Settings.invalid", FileFormat::Toml)) + .unwrap(); + + assert!(false) +} + +#[test] +fn test_error_type_bool() { + let c = make(); + + let err = c.get::<bool>("boolean_s_parse"); + + assert!(err.is_err()); + assert_eq!(err.unwrap_err().to_string(), + "invalid type: string \"fals\", expected a boolean from tests/Settings.toml".to_string()); +} |