Remove the GetStandardProperties trait.
This was using dynamic dispatch to deal with enums to avoid the repetitive typing.
This commit is contained in:
@@ -175,8 +175,8 @@ mod tests {
|
||||
use crate::parser::element_parser::element;
|
||||
use crate::types::Bold;
|
||||
use crate::types::Element;
|
||||
use crate::types::GetStandardProperties;
|
||||
use crate::types::PlainText;
|
||||
use crate::types::StandardProperties;
|
||||
|
||||
#[test]
|
||||
fn plain_text_radio_target() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -195,10 +195,7 @@ mod tests {
|
||||
_ => panic!("Should be a paragraph!"),
|
||||
};
|
||||
assert_eq!(Into::<&str>::into(remaining), "");
|
||||
assert_eq!(
|
||||
first_paragraph.get_standard_properties().get_source(),
|
||||
"foo bar baz"
|
||||
);
|
||||
assert_eq!(first_paragraph.get_source(), "foo bar baz");
|
||||
assert_eq!(first_paragraph.children.len(), 3);
|
||||
match first_paragraph
|
||||
.children
|
||||
@@ -206,7 +203,7 @@ mod tests {
|
||||
.expect("Len already asserted to be 3.")
|
||||
{
|
||||
Object::RadioLink(inner) => {
|
||||
assert_eq!(inner.get_standard_properties().get_source(), "bar ");
|
||||
assert_eq!(inner.get_source(), "bar ");
|
||||
assert_eq!(inner.path, "bar");
|
||||
assert_eq!(inner.children.len(), 1);
|
||||
let child = inner
|
||||
@@ -214,7 +211,7 @@ mod tests {
|
||||
.first()
|
||||
.expect("Length already asserted to be 1.");
|
||||
assert!(matches!(child, Object::PlainText(_)));
|
||||
assert_eq!(child.get_standard_properties().get_source(), "bar");
|
||||
assert_eq!(child.get_source(), "bar");
|
||||
}
|
||||
_ => {
|
||||
return Err("Child should be a radio link.".into());
|
||||
@@ -244,10 +241,7 @@ mod tests {
|
||||
_ => panic!("Should be a paragraph!"),
|
||||
};
|
||||
assert_eq!(Into::<&str>::into(remaining), "");
|
||||
assert_eq!(
|
||||
first_paragraph.get_standard_properties().get_source(),
|
||||
"foo *bar* baz"
|
||||
);
|
||||
assert_eq!(first_paragraph.get_source(), "foo *bar* baz");
|
||||
assert_eq!(first_paragraph.children.len(), 3);
|
||||
match first_paragraph
|
||||
.children
|
||||
@@ -255,7 +249,7 @@ mod tests {
|
||||
.expect("Len already asserted to be 3.")
|
||||
{
|
||||
Object::RadioLink(inner) => {
|
||||
assert_eq!(inner.get_standard_properties().get_source(), "*bar* ");
|
||||
assert_eq!(inner.get_source(), "*bar* ");
|
||||
assert_eq!(inner.path, "*bar* ");
|
||||
assert_eq!(inner.children.len(), 1);
|
||||
let child = inner
|
||||
@@ -263,7 +257,7 @@ mod tests {
|
||||
.first()
|
||||
.expect("Length already asserted to be 1.");
|
||||
assert!(matches!(child, Object::Bold(_)));
|
||||
assert_eq!(child.get_standard_properties().get_source(), "*bar* ");
|
||||
assert_eq!(child.get_source(), "*bar* ");
|
||||
}
|
||||
_ => {
|
||||
return Err("Child should be a radio link.".into());
|
||||
|
||||
Reference in New Issue
Block a user