@@ -3,18 +3,12 @@ use std::fs::{create_dir_all, read_to_string, File};
3
3
use std:: io:: prelude:: * ;
4
4
use std:: path:: Path ;
5
5
6
- use tempfile:: tempdir;
7
-
8
6
use rustc_span:: edition:: Edition ;
9
- use rustc_span:: DUMMY_SP ;
10
7
11
- use crate :: config:: { Options , RenderOptions } ;
12
- use crate :: doctest:: { generate_args_file, Collector , GlobalTestOptions } ;
8
+ use crate :: config:: RenderOptions ;
13
9
use crate :: html:: escape:: Escape ;
14
10
use crate :: html:: markdown;
15
- use crate :: html:: markdown:: {
16
- find_testable_code, ErrorCodes , HeadingOffset , IdMap , Markdown , MarkdownWithToc ,
17
- } ;
11
+ use crate :: html:: markdown:: { ErrorCodes , HeadingOffset , IdMap , Markdown , MarkdownWithToc } ;
18
12
19
13
/// Separate any lines at the start of the file that begin with `# ` or `%`.
20
14
fn extract_leading_metadata ( s : & str ) -> ( Vec < & str > , & str ) {
@@ -141,48 +135,3 @@ pub(crate) fn render<P: AsRef<Path>>(
141
135
Ok ( _) => Ok ( ( ) ) ,
142
136
}
143
137
}
144
-
145
- /// Runs any tests/code examples in the markdown file `input`.
146
- pub ( crate ) fn test ( options : Options ) -> Result < ( ) , String > {
147
- use rustc_session:: config:: Input ;
148
- let input_str = match & options. input {
149
- Input :: File ( path) => {
150
- read_to_string ( & path) . map_err ( |err| format ! ( "{}: {err}" , path. display( ) ) ) ?
151
- }
152
- Input :: Str { name : _, input } => input. clone ( ) ,
153
- } ;
154
-
155
- let mut opts = GlobalTestOptions :: default ( ) ;
156
- opts. no_crate_inject = true ;
157
-
158
- let temp_dir =
159
- tempdir ( ) . map_err ( |error| format ! ( "failed to create temporary directory: {error:?}" ) ) ?;
160
- let file_path = temp_dir. path ( ) . join ( "rustdoc-cfgs" ) ;
161
- generate_args_file ( & file_path, & options) ?;
162
-
163
- let mut collector = Collector :: new (
164
- options. input . filestem ( ) . to_string ( ) ,
165
- options. clone ( ) ,
166
- true ,
167
- opts,
168
- None ,
169
- options. input . opt_path ( ) . map ( ToOwned :: to_owned) ,
170
- options. enable_per_target_ignores ,
171
- file_path,
172
- ) ;
173
- collector. set_position ( DUMMY_SP ) ;
174
- let codes = ErrorCodes :: from ( options. unstable_features . is_nightly_build ( ) ) ;
175
-
176
- // For markdown files, custom code classes will be disabled until the feature is enabled by default.
177
- find_testable_code (
178
- & input_str,
179
- & mut collector,
180
- codes,
181
- options. enable_per_target_ignores ,
182
- None ,
183
- false ,
184
- ) ;
185
-
186
- crate :: doctest:: run_tests ( options. test_args , options. nocapture , collector. tests ) ;
187
- Ok ( ( ) )
188
- }
0 commit comments