mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-22 20:15:11 +00:00
Move Vars into its own module
This commit is contained in:
parent
bfb8a5a573
commit
bf8ff3675b
@ -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
src/options/vars.rs
Normal file
16
src/options/vars.rs
Normal file
@ -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()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user