aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-02-02 12:15:27 +0100
committerDaniel Mueller <deso@posteo.net>2020-09-05 11:36:12 -0700
commit9a6d04f3bfffe63021d68efad9fbf0ae3987064c (patch)
treea94de2af31b9e37bf5029f256129d42e6d018641 /src/tests
parentaa28268d9087572dc7eb62df46fcdc9db12d6de5 (diff)
downloadnitrocli-9a6d04f3bfffe63021d68efad9fbf0ae3987064c.tar.gz
nitrocli-9a6d04f3bfffe63021d68efad9fbf0ae3987064c.tar.bz2
Add config test case and example config file
This patch adds a simple configuration file that demonstrates the syntax and contains some documentation. We suggest to ship this file together with nitrocli and to install it e.g., in the /usr/share/doc/nitrocli directory. This patch also adds a simple test case that makes sure that the example file is parsed correctly.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/run.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tests/run.rs b/src/tests/run.rs
index 22e7004..597e400 100644
--- a/src/tests/run.rs
+++ b/src/tests/run.rs
@@ -17,6 +17,8 @@
// * along with this program. If not, see <http://www.gnu.org/licenses/>. *
// *************************************************************************
+use std::path;
+
use super::*;
#[test]
@@ -108,3 +110,13 @@ fn version_option() {
test(&re, "--version");
test(&re, "-V");
}
+
+#[test]
+fn config_file() {
+ let config =
+ crate::config::read_config_file(&path::Path::new("doc/config.example.toml")).unwrap();
+
+ assert_eq!(Some(crate::args::DeviceModel::Pro), config.model);
+ assert_eq!(true, config.no_cache);
+ assert_eq!(2, config.verbosity);
+}