4
4
//! rebuild the real one. There is a separate integration test `build-std`
5
5
//! which builds the real thing, but that should be avoided if possible.
6
6
7
- #![ allow( deprecated) ]
8
-
9
7
use cargo_test_support:: registry:: { Dependency , Package } ;
10
8
use 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 } ;
12
10
use std:: path:: { Path , PathBuf } ;
13
11
14
12
struct Setup {
@@ -254,14 +252,21 @@ fn simple_lib_std() {
254
252
p. cargo ( "build -v" )
255
253
. build_std ( & setup)
256
254
. 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
+ "# ] ] )
258
260
. run ( ) ;
259
261
// Check freshness.
260
262
p. change_file ( "src/lib.rs" , " " ) ;
261
263
p. cargo ( "build -v" )
262
264
. build_std ( & setup)
263
265
. 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
+ "# ] ] )
265
270
. run ( ) ;
266
271
}
267
272
@@ -273,6 +278,7 @@ fn simple_bin_std() {
273
278
p. cargo ( "run -v" ) . build_std ( & setup) . target_host ( ) . run ( ) ;
274
279
}
275
280
281
+ #[ allow( deprecated) ]
276
282
#[ cargo_test( build_std_mock) ]
277
283
fn lib_nostd ( ) {
278
284
let setup = setup ( ) ;
@@ -306,7 +312,11 @@ fn check_core() {
306
312
p. cargo ( "check -v" )
307
313
. build_std_arg ( & setup, "core" )
308
314
. 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
+ "# ] ] )
310
320
. run ( ) ;
311
321
}
312
322
@@ -366,7 +376,14 @@ fn test() {
366
376
p. cargo ( "test -v" )
367
377
. build_std ( & setup)
368
378
. 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
+ "# ] ] )
370
387
. run ( ) ;
371
388
}
372
389
@@ -483,7 +500,15 @@ fn doctest() {
483
500
484
501
p. cargo ( "test --doc -v -Zdoctest-xcompile" )
485
502
. 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
+ "# ] ] )
487
512
. target_host ( )
488
513
. run ( ) ;
489
514
}
@@ -507,7 +532,11 @@ fn no_implicit_alloc() {
507
532
p. cargo ( "build -v" )
508
533
. build_std ( & setup)
509
534
. 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
+ "# ] ] )
511
540
. with_status ( 101 )
512
541
. run ( ) ;
513
542
}
@@ -562,6 +591,7 @@ fn ignores_incremental() {
562
591
. starts_with( "foo-" ) ) ;
563
592
}
564
593
594
+ #[ allow( deprecated) ]
565
595
#[ cargo_test( build_std_mock) ]
566
596
fn cargo_config_injects_compiler_builtins ( ) {
567
597
let setup = setup ( ) ;
@@ -622,7 +652,11 @@ fn no_roots() {
622
652
p. cargo ( "build" )
623
653
. build_std ( & setup)
624
654
. 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
+ "# ] ] )
626
660
. run ( ) ;
627
661
}
628
662
@@ -648,10 +682,15 @@ fn proc_macro_only() {
648
682
p. cargo ( "build" )
649
683
. build_std ( & setup)
650
684
. 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
+ "# ] ] )
652
690
. run ( ) ;
653
691
}
654
692
693
+ #[ allow( deprecated) ]
655
694
#[ cargo_test( build_std_mock) ]
656
695
fn fetch ( ) {
657
696
let setup = setup ( ) ;
@@ -660,7 +699,12 @@ fn fetch() {
660
699
p. cargo ( "fetch" )
661
700
. build_std ( & setup)
662
701
. 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
+ "# ] ] )
664
708
. run ( ) ;
665
709
p. cargo ( "build" )
666
710
. build_std ( & setup)
0 commit comments