[librsvg/librsvg-2.50] Split FilterValueList tests between valid and invalid syntax
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/librsvg-2.50] Split FilterValueList tests between valid and invalid syntax
- Date: Fri, 2 Oct 2020 19:24:35 +0000 (UTC)
commit eb30b2dc134b64e95be65a2281b085726bdbc253
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Sep 9 10:15:01 2020 -0500
Split FilterValueList tests between valid and invalid syntax
rsvg_internals/src/filter.rs | 48 ++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 22 deletions(-)
---
diff --git a/rsvg_internals/src/filter.rs b/rsvg_internals/src/filter.rs
index ef5c8bac..1553763e 100644
--- a/rsvg_internals/src/filter.rs
+++ b/rsvg_internals/src/filter.rs
@@ -273,26 +273,30 @@ impl Parse for FilterValueList {
}
#[cfg(test)]
-#[test]
-fn parses_filter_value_list() {
- use crate::allowed_url::Fragment;
- use crate::filter::FilterValue;
-
- assert_eq!(
- FilterValueList::parse_str("none"),
- Ok(FilterValueList::default())
- );
-
- let f1 = Fragment::new(Some("foo.svg".to_string()), "bar".to_string());
- let f2 = Fragment::new(Some("test.svg".to_string()), "baz".to_string());
- assert_eq!(
- FilterValueList::parse_str("url(foo.svg#bar) url(test.svg#baz)"),
- Ok(FilterValueList(vec![
- FilterValue::URL(f1),
- FilterValue::URL(f2)
- ]))
- );
-
- assert!(FilterValueList::parse_str("fail").is_err());
- assert!(FilterValueList::parse_str("url(#test) none").is_err());
+mod tests {
+ use super::*;
+
+ #[test]
+ fn parses_filter_value_list() {
+ assert_eq!(
+ FilterValueList::parse_str("none"),
+ Ok(FilterValueList::default())
+ );
+
+ let f1 = Fragment::new(Some("foo.svg".to_string()), "bar".to_string());
+ let f2 = Fragment::new(Some("test.svg".to_string()), "baz".to_string());
+ assert_eq!(
+ FilterValueList::parse_str("url(foo.svg#bar) url(test.svg#baz)"),
+ Ok(FilterValueList(vec![
+ FilterValue::URL(f1),
+ FilterValue::URL(f2)
+ ]))
+ );
+ }
+
+ #[test]
+ fn detects_invalid_filter_value_list() {
+ assert!(FilterValueList::parse_str("fail").is_err());
+ assert!(FilterValueList::parse_str("url(#test) none").is_err());
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]