Skip to content

Commit c209c87

Browse files
committed
Check the exercise name length
1 parent dd52e9c commit c209c87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/dev/check.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
collections::{hash_set_with_capacity, HashSet},
1515
exercise::{RunnableExercise, OUTPUT_CAPACITY},
1616
info_file::{ExerciseInfo, InfoFile},
17-
CURRENT_FORMAT_VERSION,
17+
CURRENT_FORMAT_VERSION, MAX_EXERCISE_NAME_LEN,
1818
};
1919

2020
// 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>> {
5959
if name.is_empty() {
6060
bail!("Found an empty exercise name in `info.toml`");
6161
}
62+
if name.len() > MAX_EXERCISE_NAME_LEN {
63+
bail!("The length of the exercise name `{name}` is bigger than the maximum {MAX_EXERCISE_NAME_LEN}");
64+
}
6265
if let Some(c) = forbidden_char(name) {
6366
bail!("Char `{c}` in the exercise name `{name}` is not allowed");
6467
}

0 commit comments

Comments
 (0)