From f8e68f603264ccc6ced2444ca1917c67ed52bff6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 18 Jul 2022 11:01:22 +0200 Subject: Change to enable build script for commonmark tests again --- build.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'build.rs') diff --git a/build.rs b/build.rs index 78382fe..a4947f5 100644 --- a/build.rs +++ b/build.rs @@ -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 = None; - let mut case_index = 0; + let mut number = 1; let value = Regex::new(r"[\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() { -- cgit