use super::{Finding, Sh, ShellChecker};
use std::cell::RefCell;
pub struct FakeChecker {
findings: Vec<Finding>,
pub seen: RefCell<Vec<String>>,
}
impl FakeChecker {
#[must_use]
pub fn new(findings: Vec<Finding>) -> Self {
Self {
findings,
seen: RefCell::new(Vec::new()),
}
}
#[must_use]
pub fn clean() -> Self {
Self::new(Vec::new())
}
}
impl ShellChecker for FakeChecker {
fn check(&self, script: &str, _shell: Sh) -> Vec<Finding> {
self.seen.borrow_mut().push(script.to_owned());
self.findings.clone()
}
}