99// except according to those terms.
1010
1111#![ crate_type = "lib" ]
12-
13- #![ cfg_attr( not( feature = "norustc" ) , feature( rustc_private) ) ]
14- #![ cfg_attr( not( feature = "stable" ) , feature( test) ) ]
15-
1612#![ deny( unused_imports) ]
13+ #![ cfg_attr( feature = "unstable" , feature( rustc_private) ) ]
1714
18- #[ cfg( not ( feature = "norustc" ) ) ]
15+ #[ cfg( feature = "unstable" ) ]
1916extern crate rustc;
2017
2118#[ cfg( unix) ]
2219extern crate libc;
23- extern crate libtest as test ;
20+ extern crate libtest;
2421
2522#[ cfg( feature = "tmp" ) ] extern crate tempfile;
2623
@@ -84,7 +81,7 @@ pub fn run_tests(config: &Config) {
8481 // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
8582 // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
8683 env:: set_var ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
87- let res = test :: run_tests_console ( & opts, tests. into_iter ( ) . collect ( ) ) ;
84+ let res = libtest :: run_tests_console ( & opts, tests. into_iter ( ) . collect ( ) ) ;
8885 match res {
8986 Ok ( true ) => { }
9087 Ok ( false ) => panic ! ( "Some tests failed" ) ,
@@ -94,30 +91,30 @@ pub fn run_tests(config: &Config) {
9491 }
9592}
9693
97- pub fn test_opts ( config : & Config ) -> test :: TestOpts {
98- test :: TestOpts {
94+ pub fn test_opts ( config : & Config ) -> libtest :: TestOpts {
95+ libtest :: TestOpts {
9996 filter : config. filter . clone ( ) ,
10097 filter_exact : config. filter_exact ,
10198 #[ cfg( not( feature = "stable" ) ) ]
10299 exclude_should_panic : false ,
103- run_ignored : if config. run_ignored { test :: RunIgnored :: Yes } else { test :: RunIgnored :: No } ,
104- format : if config. quiet { test :: OutputFormat :: Terse } else { test :: OutputFormat :: Pretty } ,
100+ run_ignored : if config. run_ignored { libtest :: RunIgnored :: Yes } else { libtest :: RunIgnored :: No } ,
101+ format : if config. quiet { libtest :: OutputFormat :: Terse } else { libtest :: OutputFormat :: Pretty } ,
105102 logfile : config. logfile . clone ( ) ,
106103 run_tests : true ,
107104 bench_benchmarks : true ,
108105 nocapture : match env:: var ( "RUST_TEST_NOCAPTURE" ) {
109106 Ok ( val) => & val != "0" ,
110107 Err ( _) => false
111108 } ,
112- color : test :: AutoColor ,
109+ color : libtest :: ColorChoice :: Auto ,
113110 test_threads : None ,
114111 skip : vec ! [ ] ,
115112 list : false ,
116- options : test :: Options :: new ( ) ,
113+ options : libtest :: Options :: new ( ) ,
117114 }
118115}
119116
120- pub fn make_tests ( config : & Config ) -> Vec < test :: TestDescAndFn > {
117+ pub fn make_tests ( config : & Config ) -> Vec < libtest :: TestDescAndFn > {
121118 debug ! ( "making tests from {:?}" ,
122119 config. src_base. display( ) ) ;
123120 let mut tests = Vec :: new ( ) ;
@@ -134,7 +131,7 @@ fn collect_tests_from_dir(config: &Config,
134131 base : & Path ,
135132 dir : & Path ,
136133 relative_dir_path : & Path ,
137- tests : & mut Vec < test :: TestDescAndFn > )
134+ tests : & mut Vec < libtest :: TestDescAndFn > )
138135 -> io:: Result < ( ) > {
139136 // Ignore directories that contain a file
140137 // `compiletest-ignore-dir`.
@@ -224,23 +221,23 @@ pub fn is_test(file_name: &OsString) -> bool {
224221 !invalid_prefixes. iter ( ) . any ( |p| file_name. starts_with ( p) )
225222}
226223
227- pub fn make_test ( config : & Config , testpaths : & TestPaths ) -> test :: TestDescAndFn {
224+ pub fn make_test ( config : & Config , testpaths : & TestPaths ) -> libtest :: TestDescAndFn {
228225 let early_props = EarlyProps :: from_file ( config, & testpaths. file ) ;
229226
230227 // The `should-fail` annotation doesn't apply to pretty tests,
231228 // since we run the pretty printer across all tests by default.
232229 // If desired, we could add a `should-fail-pretty` annotation.
233230 let should_panic = match config. mode {
234- Pretty => test :: ShouldPanic :: No ,
231+ Pretty => libtest :: ShouldPanic :: No ,
235232 _ => if early_props. should_fail {
236- test :: ShouldPanic :: Yes
233+ libtest :: ShouldPanic :: Yes
237234 } else {
238- test :: ShouldPanic :: No
235+ libtest :: ShouldPanic :: No
239236 }
240237 } ;
241238
242- test :: TestDescAndFn {
243- desc : test :: TestDesc {
239+ libtest :: TestDescAndFn {
240+ desc : libtest :: TestDesc {
244241 name : make_test_name ( config, testpaths) ,
245242 ignore : early_props. ignore ,
246243 should_panic : should_panic,
@@ -260,23 +257,22 @@ fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
260257 . join ( stamp_name)
261258}
262259
263- pub fn make_test_name ( config : & Config , testpaths : & TestPaths ) -> test :: TestName {
260+ pub fn make_test_name ( config : & Config , testpaths : & TestPaths ) -> libtest :: TestName {
264261 // Convert a complete path to something like
265262 //
266263 // run-pass/foo/bar/baz.rs
267264 let path =
268265 PathBuf :: from ( config. src_base . file_name ( ) . unwrap ( ) )
269266 . join ( & testpaths. relative_dir )
270267 . join ( & testpaths. file . file_name ( ) . unwrap ( ) ) ;
271- test :: DynTestName ( format ! ( "[{}] {}" , config. mode, path. display( ) ) )
268+ libtest :: TestName :: DynTestName ( format ! ( "[{}] {}" , config. mode, path. display( ) ) )
272269}
273270
274- pub fn make_test_closure ( config : & Config , testpaths : & TestPaths ) -> test :: TestFn {
271+ pub fn make_test_closure ( config : & Config , testpaths : & TestPaths ) -> libtest :: TestFn {
275272 let config = config. clone ( ) ;
276273 let testpaths = testpaths. clone ( ) ;
277- test:: DynTestFn ( Box :: new ( move || {
278- #[ cfg( feature = "stable" ) ]
279- let config = config. clone ( ) ; // FIXME: why is this needed?
274+ libtest:: TestFn :: DynTestFn ( Box :: new ( move || {
275+ let config = config. clone ( ) ;
280276 runtest:: run ( config, & testpaths)
281277 } ) )
282278}
0 commit comments