Remove the GetStandardProperties trait.

This was using dynamic dispatch to deal with enums to avoid the repetitive typing.
This commit is contained in:
Tom Alexander
2023-10-31 21:20:39 -04:00
parent 49f6e70a19
commit bcf1b49db2
14 changed files with 159 additions and 218 deletions

View File

@@ -629,7 +629,7 @@ mod tests {
use crate::context::Context;
use crate::context::GlobalSettings;
use crate::context::List;
use crate::types::GetStandardProperties;
use crate::types::StandardProperties;
#[test]
fn plain_list_item_empty() {
@@ -640,7 +640,7 @@ mod tests {
let plain_list_item_matcher = bind_context!(plain_list_item, &initial_context);
let (remaining, (_, result)) = plain_list_item_matcher(input).unwrap();
assert_eq!(Into::<&str>::into(remaining), "");
assert_eq!(result.get_standard_properties().get_source(), "1.");
assert_eq!(result.get_source(), "1.");
}
#[test]
@@ -652,7 +652,7 @@ mod tests {
let plain_list_item_matcher = bind_context!(plain_list_item, &initial_context);
let (remaining, (_, result)) = plain_list_item_matcher(input).unwrap();
assert_eq!(Into::<&str>::into(remaining), "");
assert_eq!(result.get_standard_properties().get_source(), "1. foo");
assert_eq!(result.get_source(), "1. foo");
}
#[test]
@@ -664,7 +664,7 @@ mod tests {
let (remaining, result) =
plain_list(std::iter::empty(), input, &initial_context, input).unwrap();
assert_eq!(Into::<&str>::into(remaining), "");
assert_eq!(result.get_standard_properties().get_source(), "1.");
assert_eq!(result.get_source(), "1.");
}
#[test]
@@ -676,7 +676,7 @@ mod tests {
let (remaining, result) =
plain_list(std::iter::empty(), input, &initial_context, input).unwrap();
assert_eq!(Into::<&str>::into(remaining), "");
assert_eq!(result.get_standard_properties().get_source(), "1. foo");
assert_eq!(result.get_source(), "1. foo");
}
#[test]
@@ -721,7 +721,7 @@ mod tests {
plain_list_matcher(input).expect("Should parse the plain list successfully.");
assert_eq!(Into::<&str>::into(remaining), " ipsum\n");
assert_eq!(
result.get_standard_properties().get_source(),
result.get_source(),
r#"1. foo
2. bar
baz
@@ -749,7 +749,7 @@ baz"#,
plain_list_matcher(input).expect("Should parse the plain list successfully.");
assert_eq!(Into::<&str>::into(remaining), "baz");
assert_eq!(
result.get_standard_properties().get_source(),
result.get_source(),
r#"1. foo
1. bar
@@ -782,7 +782,7 @@ dolar"#,
plain_list_matcher(input).expect("Should parse the plain list successfully.");
assert_eq!(Into::<&str>::into(remaining), "dolar");
assert_eq!(
result.get_standard_properties().get_source(),
result.get_source(),
r#"1. foo
bar