Skip to content

Commit df975cf

Browse files
committed
Rename rustdoc/test -> rustdoc/doctest
This modules contains the implementation of doctests, and not the tests of rustdoc itself. This name is confusing, so let's rename it to doctest for clarity.
1 parent f7cbb7a commit df975cf

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed
File renamed without changes.
File renamed without changes.

src/librustdoc/html/markdown.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use std::fmt::Write;
3434
use std::ops::Range;
3535
use std::str;
3636

37+
use crate::doctest;
3738
use crate::html::highlight;
3839
use crate::html::toc::TocBuilder;
39-
use crate::test;
4040

4141
use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, Options, Parser, Tag};
4242

@@ -243,7 +243,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> {
243243
.collect::<Vec<Cow<'_, str>>>()
244244
.join("\n");
245245
let krate = krate.as_ref().map(|s| &**s);
246-
let (test, _) = test::make_test(&test, krate, false, &Default::default(), edition);
246+
let (test, _) = doctest::make_test(&test, krate, false, &Default::default(), edition);
247247
let channel = if test.contains("#![feature(") { "&amp;version=nightly" } else { "" };
248248

249249
let edition_string = format!("&amp;edition={}", edition);
@@ -568,7 +568,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
568568
}
569569
}
570570

571-
pub fn find_testable_code<T: test::Tester>(
571+
pub fn find_testable_code<T: doctest::Tester>(
572572
doc: &str,
573573
tests: &mut T,
574574
error_codes: ErrorCodes,

src/librustdoc/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ mod docfs;
6464
mod doctree;
6565
#[macro_use]
6666
mod error;
67+
mod doctest;
6768
mod fold;
6869
crate mod formats;
6970
pub mod html;
7071
mod json;
7172
mod markdown;
7273
mod passes;
73-
mod test;
7474
mod theme;
7575
mod visit_ast;
7676
mod visit_lib;
@@ -476,7 +476,7 @@ fn main_options(options: config::Options) -> MainResult {
476476

477477
match (options.should_test, options.markdown_input()) {
478478
(true, true) => return wrap_return(&diag, markdown::test(options)),
479-
(true, false) => return test::run(options),
479+
(true, false) => return doctest::run(options),
480480
(false, true) => {
481481
return wrap_return(
482482
&diag,

src/librustdoc/markdown.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use rustc_span::edition::Edition;
77
use rustc_span::source_map::DUMMY_SP;
88

99
use crate::config::{Options, RenderOptions};
10+
use crate::doctest::{Collector, TestOptions};
1011
use crate::html::escape::Escape;
1112
use crate::html::markdown;
1213
use crate::html::markdown::{find_testable_code, ErrorCodes, IdMap, Markdown, MarkdownWithToc};
13-
use crate::test::{Collector, TestOptions};
1414

1515
/// Separate any lines at the start of the file that begin with `# ` or `%`.
1616
fn extract_leading_metadata(s: &str) -> (Vec<&str>, &str) {

src/librustdoc/passes/doc_test_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Tests {
5454
}
5555
}
5656

57-
impl crate::test::Tester for Tests {
57+
impl crate::doctest::Tester for Tests {
5858
fn add_test(&mut self, _: String, _: LangString, _: usize) {
5959
self.found_tests += 1;
6060
}

0 commit comments

Comments
 (0)