You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if the following is expected behavior:
--- tests/reserialize.rs+++ tests/reserialize.rs@@ -1,5 +1,8 @@
#![cfg(feature = "parser")]
-use icalendar::parser::unfold;++use std::str::FromStr as _;++use icalendar::{parser::unfold, Calendar, CalendarComponent, Component, Todo};
use pretty_assertions::assert_eq;
const SAMPLE: &str = "\
@@ -50,3 +53,21 @@ fn reserialization() {
println!("{}", reserialized);
assert_eq!(SAMPLE, reserialized);
}
++#[test]+fn reserialization_multi_line_description() {+ let desc = "multi-\nline\ndescription";+ let mut todo = Todo::new();+ todo.summary("summary");+ todo.description(desc);+ let calendar = Calendar::from([todo]);++ let serialized = calendar.to_string();+ let deserialized = Calendar::from_str(&serialized).unwrap();+ let deserialized_todo = match deserialized.components.as_slice() {+ [CalendarComponent::Todo(todo)] => todo,+ _ => unreachable!(),+ };+ let deserialized_desc = deserialized_todo.get_description().unwrap();+ assert_eq!(deserialized_desc, desc);+}
This test fails:
running 1 test
thread 'reserialization_multi_line_description' panicked at tests/reserialize.rs:72:5:
assertion failed: `(left == right)`
Diff < left / right > :
<multi-\nline\ndescription
>multi-
>line
>description
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test reserialization_multi_line_description ... FAILED
It seems as if newlines are encoded to \\n (correct) but then never decoded back to \n in this scenario. I'd expect that at the level of a Todo object, I as the user shouldn't have to deal with such encoding matters -- it should all happen transparently. So I am wondering: Is this behavior intended?
The text was updated successfully, but these errors were encountered:
though I am not convinced that it is doing truly the correct thing at the right point in time (one indication being that it causes the folding_consistency test to fail).
I am not sure if the following is expected behavior:
This test fails:
It seems as if newlines are encoded to
\\n
(correct) but then never decoded back to\n
in this scenario. I'd expect that at the level of aTodo
object, I as the user shouldn't have to deal with such encoding matters -- it should all happen transparently. So I am wondering: Is this behavior intended?The text was updated successfully, but these errors were encountered: