summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-08-28 00:34:24 +0200
committermo8it <mo8it@proton.me>2024-08-28 00:34:24 +0200
commitc209c874a9b0aad4a311ef9947c734e086f83a1c (patch)
tree33af54e9e4b993efad3199a13aa75f9b4f72fe9f /src
parentdd52e9cd7239276745c2fbad02a63931327a8e48 (diff)
Check the exercise name length
Diffstat (limited to 'src')
-rw-r--r--src/dev/check.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dev/check.rs b/src/dev/check.rs
index e00d4cc..4c5e072 100644
--- a/src/dev/check.rs
+++ b/src/dev/check.rs
@@ -14,7 +14,7 @@ use crate::{
collections::{hash_set_with_capacity, HashSet},
exercise::{RunnableExercise, OUTPUT_CAPACITY},
info_file::{ExerciseInfo, InfoFile},
- CURRENT_FORMAT_VERSION,
+ CURRENT_FORMAT_VERSION, MAX_EXERCISE_NAME_LEN,
};
// Find a char that isn't allowed in the exercise's `name` or `dir`.
@@ -59,6 +59,9 @@ fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> {
if name.is_empty() {
bail!("Found an empty exercise name in `info.toml`");
}
+ if name.len() > MAX_EXERCISE_NAME_LEN {
+ bail!("The length of the exercise name `{name}` is bigger than the maximum {MAX_EXERCISE_NAME_LEN}");
+ }
if let Some(c) = forbidden_char(name) {
bail!("Char `{c}` in the exercise name `{name}` is not allowed");
}