parsers/stanza_error: fix tests behind 'component' feature

Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
pep 2025-10-21 23:19:34 +02:00
commit 7d47173318
2 changed files with 18 additions and 0 deletions

View file

@ -122,6 +122,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
- Fix compatibility to uuid 1.12 - Fix compatibility to uuid 1.12
- Implement Default for Tune - Implement Default for Tune
- Re-export xso::error::FromElementError. - Re-export xso::error::FromElementError.
- Fix a few tests behind 'component' feature
Version 0.21.0: Version 0.21.0:
2024-07-25 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> 2024-07-25 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>

View file

@ -375,9 +375,17 @@ mod tests {
#[test] #[test]
fn test_error_code() { fn test_error_code() {
#[cfg(not(feature = "component"))]
let elem: Element = r#"<error code="501" type="cancel" xmlns='jabber:client'> let elem: Element = r#"<error code="501" type="cancel" xmlns='jabber:client'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The feature requested is not implemented by the recipient or server and therefore cannot be processed.</text> <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The feature requested is not implemented by the recipient or server and therefore cannot be processed.</text>
</error>"#
.parse()
.unwrap();
#[cfg(feature = "component")]
let elem: Element = r#"<error code="501" type="cancel" xmlns='jabber:component:accept'>
<feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The feature requested is not implemented by the recipient or server and therefore cannot be processed.</text>
</error>"# </error>"#
.parse() .parse()
.unwrap(); .unwrap();
@ -387,10 +395,19 @@ mod tests {
#[test] #[test]
fn test_error_multiple_text() { fn test_error_multiple_text() {
#[cfg(not(feature = "component"))]
let elem: Element = r#"<error type="cancel" xmlns='jabber:client'> let elem: Element = r#"<error type="cancel" xmlns='jabber:client'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="fr">Nœud non trouvé</text> <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="fr">Nœud non trouvé</text>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="en">Node not found</text> <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="en">Node not found</text>
</error>"#
.parse()
.unwrap();
#[cfg(feature = "component")]
let elem: Element = r#"<error type="cancel" xmlns='jabber:component:accept'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="fr">Nœud non trouvé</text>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang="en">Node not found</text>
</error>"# </error>"#
.parse() .parse()
.unwrap(); .unwrap();