about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYacin Tmimi <yacintmimi@gmail.com>2022-03-12 01:16:08 -0500
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2022-03-15 21:40:20 -0500
commit5696e3859707d2abf12465e7bfbdcf2d9f42c8a2 (patch)
tree9a4887d92e6574e3da0b692fe4a1fdf17060b5bf /src
parent9c65db61bee3f4f47a8d889ea781902283c5b5bd (diff)
downloadrust-5696e3859707d2abf12465e7bfbdcf2d9f42c8a2.tar.gz
rust-5696e3859707d2abf12465e7bfbdcf2d9f42c8a2.zip
Add test to verify tracking issue links
Now, tracking issue links are checked against the reference number
listed in the link text to ensure they match.
Diffstat (limited to 'src')
-rw-r--r--src/test/configuration_snippet.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/configuration_snippet.rs b/src/test/configuration_snippet.rs
index 92949ab576a..c8fda7c8556 100644
--- a/src/test/configuration_snippet.rs
+++ b/src/test/configuration_snippet.rs
@@ -290,3 +290,33 @@ fn get_code_blocks() -> Vec<ConfigCodeBlock> {
 
     code_blocks
 }
+
+#[test]
+fn check_unstable_option_tracking_issue_numbers() {
+    // Ensure that tracking issue links point to the correct issue number
+    let tracking_issue =
+        regex::Regex::new(r"\(tracking issue: \[#(?P<number>\d+)\]\((?P<link>\S+)\)\)")
+            .expect("failed creating configuration pattern");
+
+    let lines = BufReader::new(
+        fs::File::open(Path::new(CONFIGURATIONS_FILE_NAME))
+            .unwrap_or_else(|_| panic!("couldn't read file {}", CONFIGURATIONS_FILE_NAME)),
+    )
+    .lines()
+    .map(Result::unwrap)
+    .enumerate();
+
+    for (idx, line) in lines {
+        if let Some(capture) = tracking_issue.captures(&line) {
+            let number = capture.name("number").unwrap().as_str();
+            let link = capture.name("link").unwrap().as_str();
+            assert!(
+                link.ends_with(number),
+                "{} on line {} does not point to issue #{}",
+                link,
+                idx + 1,
+                number,
+            );
+        }
+    }
+}