diff options
| author | mo8it <mo8it@proton.me> | 2024-08-20 13:49:48 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-08-20 13:49:48 +0200 |
| commit | 27999f2d2678607538d887032e38774a35d438b8 (patch) | |
| tree | 3585aca63ad4c9e0bbdd9e61970da4b077fdf54b /src | |
| parent | e74f2a4274e22faf050a1229b4526ceb53b55479 (diff) | |
Check if exercise doesn't contain tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/dev/check.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dev/check.rs b/src/dev/check.rs index 6cc2485..6f16e0b 100644 --- a/src/dev/check.rs +++ b/src/dev/check.rs @@ -97,7 +97,12 @@ fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> { bail!("Didn't find any `// TODO` comment in the file `{path}`.\nYou need to have at least one such comment to guide the user."); } - if !exercise_info.test && file_buf.contains("#[test]\n") { + let contains_tests = file_buf.contains("#[test]\n"); + if exercise_info.test { + if !contains_tests { + bail!("The file `{path}` doesn't contain any tests. If you don't want to add tests to this exercise, set `test = false` for this exercise in the `info.toml` file"); + } + } else if contains_tests { bail!("The file `{path}` contains tests annotated with `#[test]` but the exercise `{name}` has `test = false` in the `info.toml` file"); } |
