Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
added test case with multibyte characters for split_line
Browse files Browse the repository at this point in the history
  • Loading branch information
ronnybremer authored Feb 4, 2024
1 parent 1518ca0 commit 44b9757
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/generator/ical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ mod should {
assert_eq!(text, split_line(text.replace("\r\n ", "")));
}

#[test]
fn split_long_line_multibyte() {
// the following text includes multibyte characters (UTF-8) at strategic places to ensure
// split_line would panic if not multibyte aware
let text = "DESCRIPTION:ABCDEFGHIJ\\n\\nKLMNOPQRSTUVWXYZ123456789üABCDEFGHIJKLMNOPQRS\\n\\nTUVWXYZ123456ä7890ABCDEFGHIJKLM\\n\\nNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXöYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWX\\n\\nYZ1234567890abcdefghiÜjklm\\nnopqrstuvwx";
assert_eq!(text, split_line(text.replace("\r\n ", "")));
}

#[test]
fn protect_chars_in_params() {
assert_eq!(
Expand Down

0 comments on commit 44b9757

Please sign in to comment.