diff --git a/src/dehtml.rs b/src/dehtml.rs
index 372baa410..f12b4b9be 100644
--- a/src/dehtml.rs
+++ b/src/dehtml.rs
@@ -204,6 +204,7 @@ pub fn dehtml_manually(buf: &str) -> String {
#[cfg(test)]
mod tests {
use super::*;
+ use crate::simplify::simplify;
#[test]
fn test_dehtml() {
@@ -212,20 +213,23 @@ mod tests {
" Foo ",
"[ Foo ](https://example.com)",
),
- ("
", ""),
(" bar ", "* bar *"),
(" bar foo", "* bar _ foo"),
("& bar", "& bar"),
- // Note missing '
- ("",
"[](https://get.delta.chat/)",
),
("", ""),
+ ("\nfat text", "*fat text*"),
+ // Invalid html (at least DC should show the text if the html is invalid):
+ ("\nsome text", "some text"),
+ ("", ""),
];
for (input, output) in cases {
- assert_eq!(dehtml(input), output);
+ assert_eq!(simplify(dehtml(input), true).0, output);
}
}
@@ -284,22 +288,4 @@ mod tests {
let txt = dehtml(input);
assert_eq!(txt.trim(), "lots of text");
}
-
- #[test]
- fn test_doctype_html() {
- use crate::simplify::simplify;
-
- let input = "\nfat text";
- let txt = simplify(dehtml(input), false).0;
- assert_eq!(txt.trim(), "*fat text*");
-
- let input = "\nsome text";
- let txt = simplify(dehtml(input), false).0;
- assert_eq!(txt.trim(), "some text");
- // at least DC should show the text if the html is invalid
-
- let input = "";
- let txt = simplify(dehtml(input), false).0;
- assert_eq!(txt.trim(), "");
- }
}