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,21 @@ 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+ [FRESH] std v0.1.0 ([..]/tests/testsuite/mock-std/library/std)
268+ ...
269+ "# ] ] )
265270 . run ( ) ;
266271}
267272
@@ -273,6 +278,7 @@ fn simple_bin_std() {
273278 p. cargo ( "run -v" ) . build_std ( & setup) . target_host ( ) . run ( ) ;
274279}
275280
281+ #[ allow( deprecated) ]
276282#[ cargo_test( build_std_mock) ]
277283fn lib_nostd ( ) {
278284 let setup = setup ( ) ;
@@ -306,7 +312,11 @@ fn check_core() {
306312 p. cargo ( "check -v" )
307313 . build_std_arg ( & setup, "core" )
308314 . target_host ( )
309- . with_stderr_contains ( "[WARNING] [..]unused_fn[..]" )
315+ . with_stderr_data ( str![ [ r#"
316+ ...
317+ [WARNING] function `unused_fn` is never used
318+ ...
319+ "# ] ] )
310320 . run ( ) ;
311321}
312322
@@ -366,7 +376,14 @@ fn test() {
366376 p. cargo ( "test -v" )
367377 . build_std ( & setup)
368378 . target_host ( )
369- . with_stdout_contains ( "test tests::it_works ... ok" )
379+ . with_stdout_data ( str![ [ r#"
380+
381+ running 1 test
382+ test tests::it_works ... ok
383+
384+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
385+ ...
386+ "# ] ] )
370387 . run ( ) ;
371388}
372389
@@ -483,7 +500,15 @@ fn doctest() {
483500
484501 p. cargo ( "test --doc -v -Zdoctest-xcompile" )
485502 . build_std ( & setup)
486- . with_stdout_contains ( "test src/lib.rs - f [..] ... ok" )
503+ . with_stdout_data ( str![ [ r#"
504+
505+ running 1 test
506+ test src/lib.rs - f (line 3) ... ok
507+
508+ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in [ELAPSED]s
509+
510+
511+ "# ] ] )
487512 . target_host ( )
488513 . run ( ) ;
489514}
@@ -507,7 +532,11 @@ fn no_implicit_alloc() {
507532 p. cargo ( "build -v" )
508533 . build_std ( & setup)
509534 . target_host ( )
510- . with_stderr_contains ( "[..]use of undeclared [..]`alloc`" )
535+ . with_stderr_data ( str![ [ r#"
536+ ...
537+ error[E0433]: failed to resolve: use of undeclared crate or module `alloc`
538+ ...
539+ "# ] ] )
511540 . with_status ( 101 )
512541 . run ( ) ;
513542}
@@ -562,6 +591,7 @@ fn ignores_incremental() {
562591 . starts_with( "foo-" ) ) ;
563592}
564593
594+ #[ allow( deprecated) ]
565595#[ cargo_test( build_std_mock) ]
566596fn cargo_config_injects_compiler_builtins ( ) {
567597 let setup = setup ( ) ;
@@ -622,7 +652,11 @@ fn no_roots() {
622652 p. cargo ( "build" )
623653 . build_std ( & setup)
624654 . target_host ( )
625- . with_stderr_contains ( "[FINISHED] [..]" )
655+ . with_stderr_data ( str![ [ r#"
656+ ...
657+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
658+
659+ "# ] ] )
626660 . run ( ) ;
627661}
628662
@@ -648,10 +682,15 @@ fn proc_macro_only() {
648682 p. cargo ( "build" )
649683 . build_std ( & setup)
650684 . target_host ( )
651- . with_stderr_contains ( "[FINISHED] [..]" )
685+ . with_stderr_data ( str![ [ r#"
686+ ...
687+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
688+
689+ "# ] ] )
652690 . run ( ) ;
653691}
654692
693+ #[ allow( deprecated) ]
655694#[ cargo_test( build_std_mock) ]
656695fn fetch ( ) {
657696 let setup = setup ( ) ;
@@ -660,7 +699,12 @@ fn fetch() {
660699 p. cargo ( "fetch" )
661700 . build_std ( & setup)
662701 . target_host ( )
663- . with_stderr_contains ( "[DOWNLOADED] [..]" )
702+ . with_stderr_data ( str![ [ r#"
703+ [UPDATING] `dummy-registry` index
704+ [DOWNLOADING] crates ...
705+ [DOWNLOADED] [..] (registry `dummy-registry`)
706+ ...
707+ "# ] ] )
664708 . run ( ) ;
665709 p. cargo ( "build" )
666710 . build_std ( & setup)
0 commit comments