use std::path::PathBuf;
use std::collections::HashMap;
#[derive(Clone, Debug)]
pub struct Config
{
pub supported_file_extensions: Vec<String>,
pub test_paths: Vec<PathBuf>,
pub constants: HashMap<String, String>,
}
impl Config
{
pub fn add_extension<S>(&mut self, ext: S) where S: Into<String> {
self.supported_file_extensions.push(ext.into())
}
pub fn add_search_path<P>(&mut self, path: P) where P: Into<String> {
self.test_paths.push(PathBuf::from(path.into()));
}
pub fn is_extension_supported(&self, extension: &str) -> bool {
self.supported_file_extensions.iter().
find(|ext| &ext[..] == extension).is_some()
}
}
impl Default for Config
{
fn default() -> Self {
Config {
supported_file_extensions: Vec::new(),
test_paths: Vec::new(),
constants: HashMap::new(),
}
}
}