aboutsummaryrefslogtreecommitdiffstats
path: root/build.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 11:01:22 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 11:01:22 +0200
commitf8e68f603264ccc6ced2444ca1917c67ed52bff6 (patch)
treea15e9a60c75a1933d96edd619eff7c05f16b81a5 /build.rs
parentc1050b3527cc2d94ba1d8575e40fcc7700d3dcc3 (diff)
downloadmarkdown-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 'build.rs')
-rw-r--r--build.rs13
1 files changed, 5 insertions, 8 deletions
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<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() {