fix: github actions fmt and test fixes

This commit is contained in:
Patrik Kaprinay 2024-01-14 11:40:56 +01:00
parent acf135620b
commit 3526f9dec5
2 changed files with 7 additions and 3 deletions

View File

@ -55,7 +55,7 @@ pub struct Exercise {
// The hint text associated with the exercise // The hint text associated with the exercise
pub hint: String, pub hint: String,
// The path of the next exercise // The path of the next exercise
pub next_path: Option<PathBuf> pub next_path: Option<PathBuf>,
} }
// An enum to track of the state of an Exercise. // An enum to track of the state of an Exercise.
@ -289,6 +289,7 @@ mod test {
path: PathBuf::from("tests/fixture/state/pending_exercise.rs"), path: PathBuf::from("tests/fixture/state/pending_exercise.rs"),
mode: Mode::Compile, mode: Mode::Compile,
hint: String::from(""), hint: String::from(""),
next_path: None,
}; };
let compiled = exercise.compile().unwrap(); let compiled = exercise.compile().unwrap();
drop(compiled); drop(compiled);
@ -320,6 +321,7 @@ mod test {
path: PathBuf::from("tests/fixture/state/pending_exercise.rs"), path: PathBuf::from("tests/fixture/state/pending_exercise.rs"),
mode: Mode::Compile, mode: Mode::Compile,
hint: String::new(), hint: String::new(),
next_path: None,
}; };
let state = exercise.state(); let state = exercise.state();
@ -361,6 +363,7 @@ mod test {
path: PathBuf::from("tests/fixture/state/finished_exercise.rs"), path: PathBuf::from("tests/fixture/state/finished_exercise.rs"),
mode: Mode::Compile, mode: Mode::Compile,
hint: String::new(), hint: String::new(),
next_path: None,
}; };
assert_eq!(exercise.state(), State::Done); assert_eq!(exercise.state(), State::Done);
@ -373,6 +376,7 @@ mod test {
path: PathBuf::from("tests/fixture/success/testSuccess.rs"), path: PathBuf::from("tests/fixture/success/testSuccess.rs"),
mode: Mode::Test, mode: Mode::Test,
hint: String::new(), hint: String::new(),
next_path: None,
}; };
let out = exercise.compile().unwrap().run().unwrap(); let out = exercise.compile().unwrap().run().unwrap();
assert!(out.stdout.contains("THIS TEST TOO SHALL PASS")); assert!(out.stdout.contains("THIS TEST TOO SHALL PASS"));

View File

@ -247,9 +247,9 @@ fn main() {
} }
} }
fn edit_exercises(exercises: &mut Vec<Exercise>){ fn edit_exercises(exercises: &mut Vec<Exercise>) {
let siz = exercises.len(); let siz = exercises.len();
for i in 0.. siz { for i in 0..siz {
if i == siz - 1 { if i == siz - 1 {
exercises[i].next_path = None; exercises[i].next_path = None;
break; break;