Use "bytes" instead of "characters" consistently when talking about length of a String.

This commit is contained in:
LukeMathWalker
2024-05-22 12:06:40 +02:00
parent 0bce2485ab
commit 6c217f7b66
22 changed files with 49 additions and 55 deletions

View File

@@ -21,13 +21,13 @@ impl Ticket {
panic!("Title cannot be empty");
}
if title.len() > 50 {
panic!("Title cannot be longer than 50 characters");
panic!("Title cannot be longer than 50 bytes");
}
if description.is_empty() {
panic!("Description cannot be empty");
}
if description.len() > 500 {
panic!("Description cannot be longer than 500 characters");
panic!("Description cannot be longer than 500 bytes");
}
Ticket {
@@ -59,13 +59,13 @@ mod tests {
fn title_cannot_be_longer_than_fifty_chars() {
let error =
Ticket::new(overly_long_title(), valid_description(), Status::ToDo).unwrap_err();
assert_eq!(error, "Title cannot be longer than 50 characters");
assert_eq!(error, "Title cannot be longer than 50 bytes");
}
#[test]
fn description_cannot_be_longer_than_500_chars() {
let error =
Ticket::new(valid_title(), overly_long_description(), Status::ToDo).unwrap_err();
assert_eq!(error, "Description cannot be longer than 500 characters");
assert_eq!(error, "Description cannot be longer than 500 bytes");
}
}