Skip to content

Commit

Permalink
style: 🛁 linting
Browse files Browse the repository at this point in the history
  • Loading branch information
rodneylab committed Nov 27, 2024
1 parent 19ee1fe commit 2e05a40
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
.DS_Store
rusty-tags.vi
4 changes: 2 additions & 2 deletions src/html_process/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ fn search_html_matches_on_multiple_terms() {
#[test]
fn search_html_highlight_does_nothing_when_there_are_no_matches() {
let result = process_html(
r#"<h2>Heading</h2><p>Nobody likes maple in their apple flavoured Snapple. APPLE</p>"#,
"<h2>Heading</h2><p>Nobody likes maple in their apple flavoured Snapple. APPLE</p>",
None,
Some("nonsense"),
)
.to_string();
let expected =
r#"<h2>Heading</h2><p>Nobody likes maple in their apple flavoured Snapple. APPLE</p>"#;
"<h2>Heading</h2><p>Nobody likes maple in their apple flavoured Snapple. APPLE</p>";
assert_eq!(result, expected);
}
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ hello you
}
);

let markdown = r#"
let markdown = "
## Subheading
Paragraph text.
"#;
";

let result = markdown_to_processed_html(
markdown,
Expand All @@ -204,11 +204,11 @@ Paragraph text.
},
);

let markdown = r#"
let markdown = "
### Subheading
Link: [Example site](https://example.com).
"#;
";

let result = markdown_to_processed_html(
markdown,
Expand All @@ -219,9 +219,9 @@ Link: [Example site](https://example.com).
},
);
let html = Some(String::from(
r##"<h3 id="subheading">Subheading</h3>
r#"<h3 id="subheading">Subheading</h3>
<p>Link: <a href="https://example.com" target="_blank" rel="nofollow noopener noreferrer">Example site</a>.</p>
"##,
"#,
));
assert_eq!(
result,
Expand All @@ -236,7 +236,7 @@ Link: [Example site](https://example.com).

#[test]
fn test_mjml_to_html() {
let mjml = r#"<mjml></mjml>"#;
let mjml = r"<mjml></mjml>";
let result = mjml_to_html(mjml);
let expected = r#"<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><title></title><!--[if !mso]><!--><meta http-equiv="X-UA-Compatible" content="IE=edge"><!--<![endif]--><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
Expand Down
16 changes: 7 additions & 9 deletions src/markdown/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@ fn test_words() {

#[test]
fn test_parse_markdown_to_html() {
let markdown = r#"
let markdown = "
hello
=====
* alpha
* beta
"#;

let result =
if let Some((result, _headings, _statistics)) = parse_markdown_to_html(markdown).ok() {
result
} else {
panic!("Result expected");
};
";

let Ok((result, _headings, _statistics)) = parse_markdown_to_html(markdown) else {
panic!("Result expected");
};

let expected = String::from(
r#"<h1 id="hello">hello</h1>
<ul>
Expand Down

0 comments on commit 2e05a40

Please sign in to comment.