From 749a5c78c2075c5d37b01ec4fd23704aa5cfdf09 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Thu, 10 Jan 2019 13:49:48 -0800 Subject: 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. --- nitrocli/src/tests/run.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nitrocli/src/tests/run.rs') 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""); -- cgit v1.2.1