diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-23 08:55:53 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-23 08:55:53 +0200 |
commit | a859fe38b1044c576f042254a0f9677054b417a0 (patch) | |
tree | 19a009c49f433afefd930f37db12cec8aef9f255 /aero-dav/src | |
parent | 54d10ed48274607c7bc4e0fd5fb1919f57317b70 (diff) | |
download | aerogramme-a859fe38b1044c576f042254a0f9677054b417a0.tar.gz aerogramme-a859fe38b1044c576f042254a0f9677054b417a0.zip |
test calendar-query vevent filtering
Diffstat (limited to 'aero-dav/src')
-rw-r--r-- | aero-dav/src/caldecoder.rs | 11 | ||||
-rw-r--r-- | aero-dav/src/xml.rs | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs index 02991c2..6bc911f 100644 --- a/aero-dav/src/caldecoder.rs +++ b/aero-dav/src/caldecoder.rs @@ -974,6 +974,17 @@ mod tests { } #[tokio::test] + async fn simple_comp_filter() { + let expected = CompFilter { + name: Component::VEvent, + additional_rules: None, + }; + let src = r#"<C:comp-filter name="VEVENT" xmlns:C="urn:ietf:params:xml:ns:caldav" />"#; + let got = deserialize::<CompFilter>(src).await; + assert_eq!(got, expected); + } + + #[tokio::test] async fn basic_mkcalendar() { let expected = MkCalendar(dav::Set(dav::PropValue(vec![dav::Property::DisplayName( "Lisa's Events".into(), diff --git a/aero-dav/src/xml.rs b/aero-dav/src/xml.rs index c89f531..e59f136 100644 --- a/aero-dav/src/xml.rs +++ b/aero-dav/src/xml.rs @@ -229,7 +229,10 @@ impl<T: IRead> Reader<T> { } pub async fn maybe_find<N: Node<N>>(&mut self) -> Result<Option<N>, ParsingError> { - self.ensure_parent_has_child()?; + // We can't find anything inside a self-closed tag + if !self.parent_has_child() { + return Ok(None); + } loop { // Try parse @@ -238,6 +241,7 @@ impl<T: IRead> Reader<T> { otherwise => return otherwise.map(Some), } + // Skip or stop match self.peek() { Event::End(_) => return Ok(None), _ => self.skip().await?, |