100-exercises-to-learn-rust
100-exercises-to-learn-rust copied to clipboard
Wrong requirements in chapter 3 task 2
In chapter 3 (ticket v1) task 2 (validation) you say the following:
// - the `title` should be at most 50 bytes long.
// - the `description` should be at most 500 bytes long.
The tests on the other hand state the following:
#[should_panic(expected = "Title cannot be longer than 50 characters")]
fn title_cannot_be_longer_than_fifty_chars() {
Ticket::new(overly_long_title(), valid_description(), "To-Do".into());
}
#[should_panic(expected = "Description cannot be longer than 500 characters")]
fn description_cannot_be_longer_than_500_chars() {
Ticket::new(valid_title(), overly_long_description(), "To-Do".into());
}
This would be incorrect, as utf-8 characters can be more than one byte in size. (think ä,ß, etc.)