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

@ -375,9 +375,17 @@ mod tests {
#[test]
fn test_error_code() {
#[cfg(not(feature = "component"))]
let elem: Element = r#"<error code="501" type="cancel" xmlns='jabber:client'>
<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>"#
.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>"#
.parse()
.unwrap();
@ -387,10 +395,19 @@ mod tests {
#[test]
fn test_error_multiple_text() {
#[cfg(not(feature = "component"))]
let elem: Element = r#"<error type="cancel" xmlns='jabber:client'>
<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>"#
.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>"#
.parse()
.unwrap();