diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 11:01:22 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 11:01:22 +0200 |
commit | f8e68f603264ccc6ced2444ca1917c67ed52bff6 (patch) | |
tree | a15e9a60c75a1933d96edd619eff7c05f16b81a5 /build.rs | |
parent | c1050b3527cc2d94ba1d8575e40fcc7700d3dcc3 (diff) | |
download | markdown-rs-f8e68f603264ccc6ced2444ca1917c67ed52bff6.tar.gz markdown-rs-f8e68f603264ccc6ced2444ca1917c67ed52bff6.tar.bz2 markdown-rs-f8e68f603264ccc6ced2444ca1917c67ed52bff6.zip |
Change to enable build script for commonmark tests again
Diffstat (limited to '')
-rw-r--r-- | build.rs | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -11,7 +11,6 @@ async fn main() { async fn commonmark() { let url = "https://raw.githubusercontent.com/commonmark/commonmark-spec/0.30/spec.txt"; let data_url = "commonmark-data.txt"; - #[allow(unused_variables)] let code_url = "tests/commonmark.rs"; let value = if let Ok(value) = fs::read_to_string(data_url) { @@ -28,7 +27,7 @@ async fn commonmark() { let re_heading_prefix = Regex::new(r"#{1,6} ").unwrap(); let re_in_out = Regex::new(r"\n\.(?:\n|$)").unwrap(); let mut current_heading: Option<String> = None; - let mut case_index = 0; + let mut number = 1; let value = Regex::new(r"<!-- END TESTS -->[\s\S]*") .unwrap() @@ -54,20 +53,19 @@ async fn commonmark() { format!("{}\n", parts[1]) }; - let test = format!(" assert_eq!(\n micromark_with_options(r###\"{}\"###, DANGER),\n r###\"{}\"###,\n r###\"{} ({})\"###\n);", input, output, section, case_index); + let test = format!(" assert_eq!(\n micromark_with_options(r###\"{}\"###, DANGER),\n r###\"{}\"###,\n r###\"{} ({})\"###\n);", input, output, section, number); cases.push(test); - case_index += 1; + number += 1; } } - #[allow(unused_variables)] let doc = format!( "//! CommonMark test suite. // > 👉 **Important**: this module is generated by `build.rs`. -// > It is generate from the latest Unicode data. +// > It is generate from the latest CommonMark website. extern crate micromark; use micromark::{{micromark_with_options, Options}}; @@ -87,8 +85,7 @@ fn commonmark() {{ cases.join("\n\n") ); - // To do: enable when CM is completely fixed. - // fs::write(code_url, doc).unwrap(); + fs::write(code_url, doc).unwrap(); } async fn punctuation() { |