diff options
Diffstat (limited to 'src/verify.rs')
| -rw-r--r-- | src/verify.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/verify.rs b/src/verify.rs index ab08a27..5aa2f5c 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -5,13 +5,25 @@ use std::fs; use std::process::Command; use toml::Value; -pub fn verify() -> Result<(), ()> { +pub fn verify(start_at: Option<&str>) -> Result<(), ()> { let toml: Value = fs::read_to_string("info.toml").unwrap().parse().unwrap(); let tomlvec: &Vec<Value> = toml.get("exercises").unwrap().as_array().unwrap(); + let mut hit_start_at = false; + for i in tomlvec { + let path = i.get("path").unwrap().as_str().unwrap(); + + if let Some(start_at) = start_at { + if start_at.ends_with(path) { + hit_start_at = true; + } else if !hit_start_at { + continue; + } + } + match i.get("mode").unwrap().as_str().unwrap() { - "test" => test(i.get("path").unwrap().as_str().unwrap())?, - "compile" => compile_only(i.get("path").unwrap().as_str().unwrap())?, + "test" => test(path)?, + "compile" => compile_only(path)?, _ => (), } } |
