Benjamin Sago 8 лет назад
Родитель
Сommit
bf8ff3675b
2 измененных файлов с 20 добавлено и 16 удалено
  1. 4 16
      src/options/mod.rs
  2. 16 0
      src/options/vars.rs

+ 4 - 16
src/options/mod.rs

@@ -89,6 +89,9 @@ use self::version::VersionString;
 mod misfire;
 pub use self::misfire::Misfire;
 
+mod vars;
+pub use self::vars::Vars;
+
 mod parser;
 mod flags;
 use self::parser::MatchedFlags;
@@ -162,28 +165,13 @@ impl Options {
 }
 
 
-/// Mockable wrapper for `std::env::var_os`.
-pub trait Vars {
-    fn get(&self, name: &'static str) -> Option<OsString>;
-}
-
-
-
 
 #[cfg(test)]
 pub mod test {
-    use super::{Options, Misfire, Vars, flags};
+    use super::{Options, Misfire, flags};
     use options::parser::{Arg, MatchedFlags};
     use std::ffi::OsString;
 
-    // Test impl that just returns the value it has.
-    impl Vars for Option<OsString> {
-        fn get(&self, _name: &'static str) -> Option<OsString> {
-            self.clone()
-        }
-    }
-
-
     #[derive(PartialEq, Debug)]
     pub enum Strictnesses {
         Last,

+ 16 - 0
src/options/vars.rs

@@ -0,0 +1,16 @@
+use std::ffi::OsString;
+
+
+/// Mockable wrapper for `std::env::var_os`.
+pub trait Vars {
+    fn get(&self, name: &'static str) -> Option<OsString>;
+}
+
+
+// Test impl that just returns the value it has.
+#[cfg(test)]
+impl Vars for Option<OsString> {
+    fn get(&self, _name: &'static str) -> Option<OsString> {
+        self.clone()
+    }
+}