pub fn load(root: &Path) -> Result<Option<Declarations>, Vec<String>>Expand description
Read every declaration under root. Ok(None) when no methodology is declared, which
is the ordinary state of a repository that does not benchmark itself; an error names
every file that could not be read, because a benchmark with a silently missing task is
a different benchmark.
use majordomus_cli::economics::{load, DIR};
let dir = tempfile::tempdir().unwrap();
assert!(load(dir.path()).unwrap().is_none(), "no methodology: nothing is benchmarked");
std::fs::create_dir_all(dir.path().join(DIR)).unwrap();
std::fs::write(dir.path().join(DIR).join("methodology.yaml"), "schema: x\n").unwrap();
let errors = load(dir.path()).unwrap_err();
assert_eq!(errors.len(), 1);
assert!(errors[0].starts_with(&format!("{DIR}/methodology.yaml: ")), "{}", errors[0]);