diff --git a/src/blocking.rs b/src/blocking.rs
index b2fe70df..e12e7e49 100644
--- a/src/blocking.rs
+++ b/src/blocking.rs
@@ -155,17 +155,6 @@ mod tests {
},
];
- #[cfg(not(feature = "compat"))]
- {
- let request_elem = elem.clone();
- let error = BlocklistRequest::try_from(request_elem).unwrap_err();
- let message = match error {
- Error::ParseError(string) => string,
- _ => panic!(),
- };
- assert_eq!(message, "Unknown child in blocklist element.");
- }
-
let result_elem = elem.clone();
let result = BlocklistResult::try_from(result_elem).unwrap();
assert_eq!(result.items, two_items);
@@ -221,4 +210,16 @@ mod tests {
};
assert_eq!(message, "Unknown attribute in unblock element.");
}
+
+ #[cfg(not(feature = "compat"))]
+ #[test]
+ fn test_non_empty_blocklist_request() {
+ let elem: Element = " ".parse().unwrap();
+ let error = BlocklistRequest::try_from(elem).unwrap_err();
+ let message = match error {
+ Error::ParseError(string) => string,
+ _ => panic!(),
+ };
+ assert_eq!(message, "Unknown child in blocklist element.");
+ }
}
diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs
index 359cd8b0..d9a73b29 100644
--- a/src/jingle_ft.rs
+++ b/src/jingle_ft.rs
@@ -510,17 +510,6 @@ mod tests {
};
assert_eq!(message, "Unknown child in received element.");
- #[cfg(not(feature = "compat"))]
- {
- let elem: Element = "".parse().unwrap();
- let error = Received::try_from(elem).unwrap_err();
- let message = match error {
- Error::ParseError(string) => string,
- _ => panic!(),
- };
- assert_eq!(message, "Unknown attribute in received element.");
- }
-
let elem: Element =
""
.parse()
@@ -541,6 +530,18 @@ mod tests {
assert_eq!(message, "Unknown value for 'creator' attribute.");
}
+ #[cfg(not(feature = "compat"))]
+ #[test]
+ fn test_invalid_received() {
+ let elem: Element = "".parse().unwrap();
+ let error = Received::try_from(elem).unwrap_err();
+ let message = match error {
+ Error::ParseError(string) => string,
+ _ => panic!(),
+ };
+ assert_eq!(message, "Unknown attribute in received element.");
+ }
+
#[test]
fn test_checksum() {
let elem: Element = "w0mcJylzCn+AfvuGdqkty2+KP48=".parse().unwrap();
@@ -578,17 +579,6 @@ mod tests {
};
assert_eq!(message, "This is not a file element.");
- #[cfg(not(feature = "compat"))]
- {
- let elem: Element = "w0mcJylzCn+AfvuGdqkty2+KP48=".parse().unwrap();
- let error = Checksum::try_from(elem).unwrap_err();
- let message = match error {
- Error::ParseError(string) => string,
- _ => panic!(),
- };
- assert_eq!(message, "Unknown attribute in checksum element.");
- }
-
let elem: Element = "w0mcJylzCn+AfvuGdqkty2+KP48=".parse().unwrap();
let error = Checksum::try_from(elem).unwrap_err();
let message = match error {
@@ -606,6 +596,18 @@ mod tests {
assert_eq!(message, "Unknown value for 'creator' attribute.");
}
+ #[cfg(not(feature = "compat"))]
+ #[test]
+ fn test_invalid_checksum() {
+ let elem: Element = "w0mcJylzCn+AfvuGdqkty2+KP48=".parse().unwrap();
+ let error = Checksum::try_from(elem).unwrap_err();
+ let message = match error {
+ Error::ParseError(string) => string,
+ _ => panic!(),
+ };
+ assert_eq!(message, "Unknown attribute in checksum element.");
+ }
+
#[test]
fn test_range() {
let elem: Element = ""
@@ -633,18 +635,19 @@ mod tests {
assert_eq!(range2.offset, 2048);
assert_eq!(range2.length, Some(1024));
assert_eq!(range2.hashes, hashes);
+ }
+ #[cfg(not(feature = "compat"))]
+ #[test]
+ fn test_invalid_range() {
let elem: Element = ""
.parse()
.unwrap();
- #[cfg(not(feature = "compat"))]
- {
- let error = Range::try_from(elem).unwrap_err();
- let message = match error {
- Error::ParseError(string) => string,
- _ => panic!(),
- };
- assert_eq!(message, "Unknown attribute in range element.");
- }
+ let error = Range::try_from(elem).unwrap_err();
+ let message = match error {
+ Error::ParseError(string) => string,
+ _ => panic!(),
+ };
+ assert_eq!(message, "Unknown attribute in range element.");
}
}