From c209c874a9b0aad4a311ef9947c734e086f83a1c Mon Sep 17 00:00:00 2001 From: mo8it Date: Wed, 28 Aug 2024 00:34:24 +0200 Subject: [PATCH] Check the exercise name length --- src/dev/check.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dev/check.rs b/src/dev/check.rs index e00d4cc1..4c5e0728 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> { 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"); }