44//! rebuild the real one. There is a separate integration test `build-std`
55//! which builds the real thing, but that should be avoided if possible.
66
7- #![ allow( deprecated) ]
8-
97use cargo_test_support:: registry:: { Dependency , Package } ;
108use cargo_test_support:: ProjectBuilder ;
11- use cargo_test_support:: { paths, project, rustc_host, Execs } ;
9+ use cargo_test_support:: { paths, project, rustc_host, str , Execs } ;
1210use std:: path:: { Path , PathBuf } ;
1311
1412struct Setup {
@@ -254,14 +252,22 @@ fn simple_lib_std() {
254252 p. cargo ( "build -v" )
255253 . build_std ( & setup)
256254 . target_host ( )
257- . with_stderr_contains ( "[RUNNING] `[..]--crate-name std [..]`" )
255+ . with_stderr_data ( str![ [ r#"
256+ ...
257+ [RUNNING] `[..] rustc --crate-name std [..]`
258+ ...
259+ "# ] ] )
258260 . run ( ) ;
259261 // Check freshness.
260262 p. change_file ( "src/lib.rs" , " " ) ;
261263 p. cargo ( "build -v" )
262264 . build_std ( & setup)
263265 . target_host ( )
264- . with_stderr_contains ( "[FRESH] std[..]" )
266+ . with_stderr_data ( str![ [ r#"
267+ ...
268+ [FRESH] std v0.1.0 ([..]/tests/testsuite/mock-std/library/std)
269+ ...
270+ "# ] ] )
265271 . run ( ) ;
266272}
267273
@@ -273,6 +279,7 @@ fn simple_bin_std() {
273279 p. cargo ( "run -v" ) . build_std ( & setup) . target_host ( ) . run ( ) ;
274280}
275281
282+ #[ allow( deprecated) ]
276283#[ cargo_test( build_std_mock) ]
277284fn lib_nostd ( ) {
278285 let setup = setup ( ) ;
@@ -306,7 +313,11 @@ fn check_core() {
306313 p. cargo ( "check -v" )
307314 . build_std_arg ( & setup, "core" )
308315 . target_host ( )
309- . with_stderr_contains ( "[WARNING] [..]unused_fn[..]" )
316+ . with_stderr_data ( str![ [ r#"
317+ ...
318+ [WARNING] function `unused_fn` is never used
319+ ...
320+ "# ] ] )
310321 . run ( ) ;
311322}
312323
@@ -366,7 +377,14 @@ fn test() {
366377 p. cargo ( "test -v" )
367378 . build_std ( & setup)
368379 . target_host ( )
369- . with_stdout_contains ( "test tests::it_works ... ok" )
380+ . with_stdout_data ( str![ [ r#"
381+
382+ running 1 test
383+ test tests::it_works ... ok
384+
385+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
386+ ...
387+ "# ] ] )
370388 . run ( ) ;
371389}
372390
@@ -483,7 +501,15 @@ fn doctest() {
483501
484502 p. cargo ( "test --doc -v -Zdoctest-xcompile" )
485503 . build_std ( & setup)
486- . with_stdout_contains ( "test src/lib.rs - f [..] ... ok" )
504+ . with_stdout_data ( str![ [ r#"
505+
506+ running 1 test
507+ test src/lib.rs - f (line 3) ... ok
508+
509+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
510+
511+
512+ "# ] ] )
487513 . target_host ( )
488514 . run ( ) ;
489515}
@@ -507,7 +533,11 @@ fn no_implicit_alloc() {
507533 p. cargo ( "build -v" )
508534 . build_std ( & setup)
509535 . target_host ( )
510- . with_stderr_contains ( "[..]use of undeclared [..]`alloc`" )
536+ . with_stderr_data ( str![ [ r#"
537+ ...
538+ error[E0433]: failed to resolve: use of undeclared crate or module `alloc`
539+ ...
540+ "# ] ] )
511541 . with_status ( 101 )
512542 . run ( ) ;
513543}
@@ -562,6 +592,7 @@ fn ignores_incremental() {
562592 . starts_with( "foo-" ) ) ;
563593}
564594
595+ #[ allow( deprecated) ]
565596#[ cargo_test( build_std_mock) ]
566597fn cargo_config_injects_compiler_builtins ( ) {
567598 let setup = setup ( ) ;
@@ -622,7 +653,11 @@ fn no_roots() {
622653 p. cargo ( "build" )
623654 . build_std ( & setup)
624655 . target_host ( )
625- . with_stderr_contains ( "[FINISHED] [..]" )
656+ . with_stderr_data ( str![ [ r#"
657+ ...
658+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
659+
660+ "# ] ] )
626661 . run ( ) ;
627662}
628663
@@ -648,10 +683,15 @@ fn proc_macro_only() {
648683 p. cargo ( "build" )
649684 . build_std ( & setup)
650685 . target_host ( )
651- . with_stderr_contains ( "[FINISHED] [..]" )
686+ . with_stderr_data ( str![ [ r#"
687+ ...
688+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
689+
690+ "# ] ] )
652691 . run ( ) ;
653692}
654693
694+ #[ allow( deprecated) ]
655695#[ cargo_test( build_std_mock) ]
656696fn fetch ( ) {
657697 let setup = setup ( ) ;
0 commit comments