1- use super :: { make_test, TestOptions } ;
1+ use super :: { make_test, GlobalTestOptions } ;
22use rustc_span:: edition:: DEFAULT_EDITION ;
33
44#[ test]
55fn make_test_basic ( ) {
66 //basic use: wraps with `fn main`, adds `#![allow(unused)]`
7- let opts = TestOptions :: default ( ) ;
7+ let opts = GlobalTestOptions :: default ( ) ;
88 let input = "assert_eq!(2+2, 4);" ;
99 let expected = "#![allow(unused)]
1010fn main() {
@@ -19,7 +19,7 @@ assert_eq!(2+2, 4);
1919fn make_test_crate_name_no_use ( ) {
2020 // If you give a crate name but *don't* use it within the test, it won't bother inserting
2121 // the `extern crate` statement.
22- let opts = TestOptions :: default ( ) ;
22+ let opts = GlobalTestOptions :: default ( ) ;
2323 let input = "assert_eq!(2+2, 4);" ;
2424 let expected = "#![allow(unused)]
2525fn main() {
@@ -34,7 +34,7 @@ assert_eq!(2+2, 4);
3434fn make_test_crate_name ( ) {
3535 // If you give a crate name and use it within the test, it will insert an `extern crate`
3636 // statement before `fn main`.
37- let opts = TestOptions :: default ( ) ;
37+ let opts = GlobalTestOptions :: default ( ) ;
3838 let input = "use asdf::qwop;
3939assert_eq!(2+2, 4);" ;
4040 let expected = "#![allow(unused)]
@@ -52,7 +52,7 @@ assert_eq!(2+2, 4);
5252fn make_test_no_crate_inject ( ) {
5353 // Even if you do use the crate within the test, setting `opts.no_crate_inject` will skip
5454 // adding it anyway.
55- let opts = TestOptions { no_crate_inject : true , attrs : vec ! [ ] } ;
55+ let opts = GlobalTestOptions { no_crate_inject : true , attrs : vec ! [ ] } ;
5656 let input = "use asdf::qwop;
5757assert_eq!(2+2, 4);" ;
5858 let expected = "#![allow(unused)]
@@ -70,7 +70,7 @@ fn make_test_ignore_std() {
7070 // Even if you include a crate name, and use it in the doctest, we still won't include an
7171 // `extern crate` statement if the crate is "std" -- that's included already by the
7272 // compiler!
73- let opts = TestOptions :: default ( ) ;
73+ let opts = GlobalTestOptions :: default ( ) ;
7474 let input = "use std::*;
7575assert_eq!(2+2, 4);" ;
7676 let expected = "#![allow(unused)]
@@ -87,7 +87,7 @@ assert_eq!(2+2, 4);
8787fn make_test_manual_extern_crate ( ) {
8888 // When you manually include an `extern crate` statement in your doctest, `make_test`
8989 // assumes you've included one for your own crate too.
90- let opts = TestOptions :: default ( ) ;
90+ let opts = GlobalTestOptions :: default ( ) ;
9191 let input = "extern crate asdf;
9292use asdf::qwop;
9393assert_eq!(2+2, 4);" ;
@@ -104,7 +104,7 @@ assert_eq!(2+2, 4);
104104
105105#[ test]
106106fn make_test_manual_extern_crate_with_macro_use ( ) {
107- let opts = TestOptions :: default ( ) ;
107+ let opts = GlobalTestOptions :: default ( ) ;
108108 let input = "#[macro_use] extern crate asdf;
109109use asdf::qwop;
110110assert_eq!(2+2, 4);" ;
@@ -123,7 +123,7 @@ assert_eq!(2+2, 4);
123123fn make_test_opts_attrs ( ) {
124124 // If you supplied some doctest attributes with `#![doc(test(attr(...)))]`, it will use
125125 // those instead of the stock `#![allow(unused)]`.
126- let mut opts = TestOptions :: default ( ) ;
126+ let mut opts = GlobalTestOptions :: default ( ) ;
127127 opts. attrs . push ( "feature(sick_rad)" . to_string ( ) ) ;
128128 let input = "use asdf::qwop;
129129assert_eq!(2+2, 4);" ;
@@ -155,7 +155,7 @@ assert_eq!(2+2, 4);
155155fn make_test_crate_attrs ( ) {
156156 // Including inner attributes in your doctest will apply them to the whole "crate", pasting
157157 // them outside the generated main function.
158- let opts = TestOptions :: default ( ) ;
158+ let opts = GlobalTestOptions :: default ( ) ;
159159 let input = "#![feature(sick_rad)]
160160assert_eq!(2+2, 4);" ;
161161 let expected = "#![allow(unused)]
@@ -171,7 +171,7 @@ assert_eq!(2+2, 4);
171171#[ test]
172172fn make_test_with_main ( ) {
173173 // Including your own `fn main` wrapper lets the test use it verbatim.
174- let opts = TestOptions :: default ( ) ;
174+ let opts = GlobalTestOptions :: default ( ) ;
175175 let input = "fn main() {
176176 assert_eq!(2+2, 4);
177177}" ;
@@ -187,7 +187,7 @@ fn main() {
187187#[ test]
188188fn make_test_fake_main ( ) {
189189 // ... but putting it in a comment will still provide a wrapper.
190- let opts = TestOptions :: default ( ) ;
190+ let opts = GlobalTestOptions :: default ( ) ;
191191 let input = "//Ceci n'est pas une `fn main`
192192assert_eq!(2+2, 4);" ;
193193 let expected = "#![allow(unused)]
@@ -203,7 +203,7 @@ assert_eq!(2+2, 4);
203203#[ test]
204204fn make_test_dont_insert_main ( ) {
205205 // Even with that, if you set `dont_insert_main`, it won't create the `fn main` wrapper.
206- let opts = TestOptions :: default ( ) ;
206+ let opts = GlobalTestOptions :: default ( ) ;
207207 let input = "//Ceci n'est pas une `fn main`
208208assert_eq!(2+2, 4);" ;
209209 let expected = "#![allow(unused)]
@@ -216,7 +216,7 @@ assert_eq!(2+2, 4);"
216216
217217#[ test]
218218fn make_test_issues_21299_33731 ( ) {
219- let opts = TestOptions :: default ( ) ;
219+ let opts = GlobalTestOptions :: default ( ) ;
220220
221221 let input = "// fn main
222222assert_eq!(2+2, 4);" ;
@@ -248,7 +248,7 @@ assert_eq!(asdf::foo, 4);
248248
249249#[ test]
250250fn make_test_main_in_macro ( ) {
251- let opts = TestOptions :: default ( ) ;
251+ let opts = GlobalTestOptions :: default ( ) ;
252252 let input = "#[macro_use] extern crate my_crate;
253253test_wrapper! {
254254 fn main() {}
@@ -267,7 +267,7 @@ test_wrapper! {
267267#[ test]
268268fn make_test_returns_result ( ) {
269269 // creates an inner function and unwraps it
270- let opts = TestOptions :: default ( ) ;
270+ let opts = GlobalTestOptions :: default ( ) ;
271271 let input = "use std::io;
272272let mut input = String::new();
273273io::stdin().read_line(&mut input)?;
@@ -287,7 +287,7 @@ Ok::<(), io:Error>(())
287287#[ test]
288288fn make_test_named_wrapper ( ) {
289289 // creates an inner function with a specific name
290- let opts = TestOptions :: default ( ) ;
290+ let opts = GlobalTestOptions :: default ( ) ;
291291 let input = "assert_eq!(2+2, 4);" ;
292292 let expected = "#![allow(unused)]
293293fn main() { #[allow(non_snake_case)] fn _doctest_main__some_unique_name() {
0 commit comments