Use "bytes" instead of "characters" consistently when talking about length of a String.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// TODO: Implement `TryFrom<String>` and `TryFrom<&str>` for the `TicketDescription` type,
|
||||
// enforcing that the description is not empty and is not longer than 500 characters.
|
||||
// enforcing that the description is not empty and is not longer than 500 bytes.
|
||||
// Implement the traits required to make the tests pass too.
|
||||
|
||||
pub struct TicketDescription(String);
|
||||
@@ -27,7 +27,7 @@ mod tests {
|
||||
let err = TicketDescription::try_from(description).unwrap_err();
|
||||
assert_eq!(
|
||||
err.to_string(),
|
||||
"The description cannot be longer than 500 characters"
|
||||
"The description cannot be longer than 500 bytes"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,7 @@ mod tests {
|
||||
"A title that's definitely longer than what should be allowed in a development ticket"
|
||||
.to_string();
|
||||
let err = TicketTitle::try_from(title).unwrap_err();
|
||||
assert_eq!(
|
||||
err.to_string(),
|
||||
"The title cannot be longer than 50 characters"
|
||||
);
|
||||
assert_eq!(err.to_string(), "The title cannot be longer than 50 bytes");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user