mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
Add tests for dc_dehtml
This commit is contained in:
committed by
holger krekel
parent
38f39c8d32
commit
b3b1e37192
@@ -165,3 +165,28 @@ fn dehtml_starttag_cb<B: std::io::BufRead>(
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_dc_dehtml() {
|
||||||
|
let cases = vec",
|
||||||
|
),
|
||||||
|
("<img href='/foo.png'>", ""),
|
||||||
|
("<b> bar </b>", "* bar *"),
|
||||||
|
("<b> bar <i> foo", "* bar _ foo"),
|
||||||
|
("& bar", "& bar"),
|
||||||
|
// Note missing '
|
||||||
|
("<a href='/foo.png>Hi</a> ", ""),
|
||||||
|
("", ""),
|
||||||
|
];
|
||||||
|
for (input, output) in cases {
|
||||||
|
assert_eq!(dc_dehtml(input), output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user