]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Don't run Markdown tests twice
authorOliver Middleton <olliemail27@gmail.com>
Wed, 5 Jul 2017 14:47:54 +0000 (15:47 +0100)
committerOliver Middleton <olliemail27@gmail.com>
Thu, 6 Jul 2017 15:47:58 +0000 (16:47 +0100)
This matches the behaviour for finding tests in Rust files.

src/librustdoc/markdown.rs

index 057ce69d9de8bcf925f59cb3a9c7700763202d40..57e8e88cd13dd7795944d2a44c6d12f1ab594db0 100644 (file)
@@ -163,8 +163,12 @@ pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
                                        true, opts, maybe_sysroot, None,
                                        Some(input.to_owned()),
                                        render_type);
-    old_find_testable_code(&input_str, &mut collector, DUMMY_SP);
-    find_testable_code(&input_str, &mut collector, DUMMY_SP);
+    if render_type == RenderType::Pulldown {
+        old_find_testable_code(&input_str, &mut collector, DUMMY_SP);
+        find_testable_code(&input_str, &mut collector, DUMMY_SP);
+    } else {
+        old_find_testable_code(&input_str, &mut collector, DUMMY_SP);
+    }
     test_args.insert(0, "rustdoctest".to_string());
     testing::test_main(&test_args, collector.tests,
                        testing::Options::new().display_output(display_warnings));