Skip to content

Commit

Permalink
Rename rustdoc/test -> rustdoc/doctest
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matklad committed Aug 27, 2020
1 parent f7cbb7a commit df975cf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/librustdoc/html/markdown.rs
Expand Up @@ -34,9 +34,9 @@ use std::fmt::Write;
use std::ops::Range;
use std::str;

use crate::doctest;
use crate::html::highlight;
use crate::html::toc::TocBuilder;
use crate::test;

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

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

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

pub fn find_testable_code<T: test::Tester>(
pub fn find_testable_code<T: doctest::Tester>(
doc: &str,
tests: &mut T,
error_codes: ErrorCodes,
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/lib.rs
Expand Up @@ -64,13 +64,13 @@ mod docfs;
mod doctree;
#[macro_use]
mod error;
mod doctest;
mod fold;
crate mod formats;
pub mod html;
mod json;
mod markdown;
mod passes;
mod test;
mod theme;
mod visit_ast;
mod visit_lib;
Expand Down Expand Up @@ -476,7 +476,7 @@ fn main_options(options: config::Options) -> MainResult {

match (options.should_test, options.markdown_input()) {
(true, true) => return wrap_return(&diag, markdown::test(options)),
(true, false) => return test::run(options),
(true, false) => return doctest::run(options),
(false, true) => {
return wrap_return(
&diag,
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/markdown.rs
Expand Up @@ -7,10 +7,10 @@ use rustc_span::edition::Edition;
use rustc_span::source_map::DUMMY_SP;

use crate::config::{Options, RenderOptions};
use crate::doctest::{Collector, TestOptions};
use crate::html::escape::Escape;
use crate::html::markdown;
use crate::html::markdown::{find_testable_code, ErrorCodes, IdMap, Markdown, MarkdownWithToc};
use crate::test::{Collector, TestOptions};

/// Separate any lines at the start of the file that begin with `# ` or `%`.
fn extract_leading_metadata(s: &str) -> (Vec<&str>, &str) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/passes/doc_test_lints.rs
Expand Up @@ -54,7 +54,7 @@ impl Tests {
}
}

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

0 comments on commit df975cf

Please sign in to comment.