about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-11-24 18:06:23 -0800
committerNoah Lev <camelidcamel@gmail.com>2021-12-01 15:12:10 -0800
commite2846a779d4b211e16e72eb7c01f74d48abb6cca (patch)
tree26a693e07195b0cc7d94e759972d43c9b4ede4bb /src/tools/compiletest
parentd2c24aabcddd1eb11af633ab6b7391ae0cd00ea2 (diff)
downloadrust-e2846a779d4b211e16e72eb7c01f74d48abb6cca.tar.gz
rust-e2846a779d4b211e16e72eb7c01f74d48abb6cca.zip
Implement `@snapshot` check for htmldocck
This form of check allows performing snapshot tests (à la `src/test/ui`)
on rustdoc HTML output, making it easier to create and update tests.

See this Zulip thread [1] for more information about the motivation for
this change.

[1]: https://zulip-archive.rust-lang.org/stream/266220-rustdoc/topic/HTML.20snapshot.20tests.html#262651142
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/runtest.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 3c85b9076dd..d0ad4b80cde 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2217,12 +2217,12 @@ impl<'test> TestCx<'test> {
             self.check_rustdoc_test_option(proc_res);
         } else {
             let root = self.config.find_rust_src_root().unwrap();
-            let res = self.cmd2procres(
-                Command::new(&self.config.docck_python)
-                    .arg(root.join("src/etc/htmldocck.py"))
-                    .arg(&out_dir)
-                    .arg(&self.testpaths.file),
-            );
+            let mut cmd = Command::new(&self.config.docck_python);
+            cmd.arg(root.join("src/etc/htmldocck.py")).arg(&out_dir).arg(&self.testpaths.file);
+            if self.config.bless {
+                cmd.arg("--bless");
+            }
+            let res = self.cmd2procres(&mut cmd);
             if !res.status.success() {
                 self.fatal_proc_rec_with_ctx("htmldocck failed!", &res, |mut this| {
                     this.compare_to_default_rustdoc(&out_dir)