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.
This commit is contained in:
Aleksey Kladov 2020-08-27 18:20:15 +02:00
parent f7cbb7a594
commit df975cf9c2
6 changed files with 7 additions and 7 deletions

View File

@ -34,9 +34,9 @@
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};
@ -243,7 +243,7 @@ fn next(&mut self) -> Option<Self::Item> {
.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);
@ -568,7 +568,7 @@ fn next(&mut self) -> Option<Self::Item> {
}
}
pub fn find_testable_code<T: test::Tester>(
pub fn find_testable_code<T: doctest::Tester>(
doc: &str,
tests: &mut T,
error_codes: ErrorCodes,

View File

@ -64,13 +64,13 @@
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;
@ -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,

View File

@ -7,10 +7,10 @@
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) {

View File

@ -54,7 +54,7 @@ pub(crate) fn new() -> 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;
}