aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/run.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-10 13:49:48 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-10 13:49:48 -0800
commit749a5c78c2075c5d37b01ec4fd23704aa5cfdf09 (patch)
tree0c547995a46cc93ca94c0b09900cd372bfaf5cb7 /nitrocli/src/tests/run.rs
parent886788a95a3c79a7664cbcd0bfffa1e500461adf (diff)
downloadnitrocli-749a5c78c2075c5d37b01ec4fd23704aa5cfdf09.tar.gz
nitrocli-749a5c78c2075c5d37b01ec4fd23704aa5cfdf09.tar.bz2
Refactor integration test code internals for program invocation
In the future we will need to perform a sequence of invocations of the program for testing purposes, with each having a slightly different execution context. Such a scheme does not map very well to the existing design where we essentially just have a function invocation to run the program. We would either have functions that produce a different execution context or pass in the data to modify. Neither of these approaches is appealing and so this change reworks the code slightly. With it, we now can create a Nitrocli object, which contains the data that diverges from the default execution context. This data will eventually be modifiable by callers.
Diffstat (limited to 'nitrocli/src/tests/run.rs')
-rw-r--r--nitrocli/src/tests/run.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/nitrocli/src/tests/run.rs b/nitrocli/src/tests/run.rs
index 51c2b87..260a851 100644
--- a/nitrocli/src/tests/run.rs
+++ b/nitrocli/src/tests/run.rs
@@ -18,11 +18,10 @@
// *************************************************************************
use super::*;
-use crate::tests::nitrocli;
#[test]
fn no_command_or_option() {
- let (rc, out, err) = nitrocli::run(NO_DEV, &[]);
+ let (rc, out, err) = Nitrocli::new().run(&[]);
assert_ne!(rc, 0);
assert_eq!(out, b"");
@@ -34,7 +33,7 @@ fn no_command_or_option() {
#[test]
fn help_option() {
fn test(opt: &'static str) {
- let (rc, out, err) = nitrocli::run(NO_DEV, &[opt]);
+ let (rc, out, err) = Nitrocli::new().run(&[opt]);
assert_eq!(rc, 0);
assert_eq!(err, b"");