@@ -22,11 +22,11 @@ fn cargo_compile_simple() {
22
22
. file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
23
23
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) ) ;
24
24
25
- assert_that ( p. cargo_process ( "build" ) , execs ( ) ) ;
25
+ assert_that ( p. cargo_process ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
26
26
assert_that ( & p. bin ( "foo" ) , existing_file ( ) ) ;
27
27
28
28
assert_that ( process ( & p. bin ( "foo" ) ) ,
29
- execs ( ) . with_stdout ( "i am foo\n " ) ) ;
29
+ execs ( ) . with_status ( 0 ) . with_stdout ( "i am foo\n " ) ) ;
30
30
}
31
31
32
32
#[ test]
@@ -308,7 +308,7 @@ fn cargo_compile_with_warnings_in_the_root_package() {
308
308
. file ( "src/foo.rs" , "fn main() {} fn dead() {}" ) ;
309
309
310
310
assert_that ( p. cargo_process ( "build" ) ,
311
- execs ( ) . with_stderr_contains ( "\
311
+ execs ( ) . with_status ( 0 ) . with_stderr_contains ( "\
312
312
[..]function is never used: `dead`[..]
313
313
" ) ) ;
314
314
}
@@ -354,15 +354,15 @@ fn cargo_compile_with_warnings_in_a_dep_package() {
354
354
"# ) ;
355
355
356
356
assert_that ( p. cargo_process ( "build" ) ,
357
- execs ( ) . with_stderr_contains ( "\
357
+ execs ( ) . with_status ( 0 ) . with_stderr_contains ( "\
358
358
[..]function is never used: `dead`[..]
359
359
" ) ) ;
360
360
361
361
assert_that ( & p. bin ( "foo" ) , existing_file ( ) ) ;
362
362
363
363
assert_that (
364
364
process ( & p. bin ( "foo" ) ) ,
365
- execs ( ) . with_stdout ( "test passed\n " ) ) ;
365
+ execs ( ) . with_status ( 0 ) . with_stdout ( "test passed\n " ) ) ;
366
366
}
367
367
368
368
#[ test]
@@ -423,7 +423,7 @@ fn cargo_compile_with_nested_deps_inferred() {
423
423
424
424
assert_that (
425
425
process ( & p. bin ( "foo" ) ) ,
426
- execs ( ) . with_stdout ( "test passed\n " ) ) ;
426
+ execs ( ) . with_status ( 0 ) . with_stdout ( "test passed\n " ) ) ;
427
427
}
428
428
429
429
#[ test]
@@ -484,7 +484,7 @@ fn cargo_compile_with_nested_deps_correct_bin() {
484
484
485
485
assert_that (
486
486
process ( & p. bin ( "foo" ) ) ,
487
- execs ( ) . with_stdout ( "test passed\n " ) ) ;
487
+ execs ( ) . with_status ( 0 ) . with_stdout ( "test passed\n " ) ) ;
488
488
}
489
489
490
490
#[ test]
@@ -554,7 +554,7 @@ fn cargo_compile_with_nested_deps_shorthand() {
554
554
555
555
assert_that (
556
556
process ( & p. bin ( "foo" ) ) ,
557
- execs ( ) . with_stdout ( "test passed\n " ) ) ;
557
+ execs ( ) . with_status ( 0 ) . with_stdout ( "test passed\n " ) ) ;
558
558
}
559
559
560
560
#[ test]
@@ -623,7 +623,7 @@ fn cargo_compile_with_nested_deps_longhand() {
623
623
assert_that ( & p. bin ( "libbaz.rlib" ) , is_not ( existing_file ( ) ) ) ;
624
624
625
625
assert_that ( process ( & p. bin ( "foo" ) ) ,
626
- execs ( ) . with_stdout ( "test passed\n " ) ) ;
626
+ execs ( ) . with_status ( 0 ) . with_stdout ( "test passed\n " ) ) ;
627
627
}
628
628
629
629
// Check that Cargo gives a sensible error if a dependency can't be found
@@ -878,6 +878,8 @@ fn crate_env_vars() {
878
878
assert_eq!("foo", PKG_NAME);
879
879
assert_eq!("http://example.com", HOMEPAGE);
880
880
assert_eq!("This is foo", DESCRIPTION);
881
+ let s = format!("{}.{}.{}-{}", VERSION_MAJOR,
882
+ VERSION_MINOR, VERSION_PATCH, VERSION_PRE);
881
883
assert_eq!(s, VERSION);
882
884
}
883
885
"# )
@@ -897,8 +899,8 @@ fn crate_env_vars() {
897
899
898
900
println ! ( "bin" ) ;
899
901
assert_that ( process ( & p. bin ( "foo" ) ) ,
900
- execs ( ) . with_stdout ( & format ! ( "0-5-1 @ alpha.1 in {}\n " ,
901
- p. root( ) . display( ) ) ) ) ;
902
+ execs ( ) . with_status ( 0 ) . with_stdout ( & format ! ( "0-5-1 @ alpha.1 in {}\n " ,
903
+ p. root( ) . display( ) ) ) ) ;
902
904
903
905
println ! ( "test" ) ;
904
906
assert_that ( p. cargo ( "test" ) . arg ( "-v" ) ,
@@ -937,7 +939,7 @@ fn crate_authors_env_vars() {
937
939
938
940
println ! ( "bin" ) ;
939
941
assert_that ( process ( & p. bin ( "foo" ) ) ,
940
-
942
+ execs ( ) . with_status ( 0 ) . with_stdout ( "[email protected] :[email protected] " ) ) ;
941
943
942
944
println ! ( "test" ) ;
943
945
assert_that ( p. cargo ( "test" ) . arg ( "-v" ) ,
@@ -1090,11 +1092,11 @@ fn ignore_broken_symlinks() {
1090
1092
. file ( "src/foo.rs" , & main_file ( r#""i am foo""# , & [ ] ) )
1091
1093
. symlink ( "Notafile" , "bar" ) ;
1092
1094
1093
- assert_that ( p. cargo_process ( "build" ) , execs ( ) ) ;
1095
+ assert_that ( p. cargo_process ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
1094
1096
assert_that ( & p. bin ( "foo" ) , existing_file ( ) ) ;
1095
1097
1096
1098
assert_that ( process ( & p. bin ( "foo" ) ) ,
1097
- execs ( ) . with_stdout ( "i am foo\n " ) ) ;
1099
+ execs ( ) . with_status ( 0 ) . with_stdout ( "i am foo\n " ) ) ;
1098
1100
}
1099
1101
1100
1102
#[ test]
@@ -1302,9 +1304,9 @@ fn explicit_examples() {
1302
1304
1303
1305
assert_that ( p. cargo_process ( "test" ) . arg ( "-v" ) , execs ( ) . with_status ( 0 ) ) ;
1304
1306
assert_that ( process ( & p. bin ( "examples/hello" ) ) ,
1305
- execs ( ) . with_stdout ( "Hello, World!\n " ) ) ;
1307
+ execs ( ) . with_status ( 0 ) . with_stdout ( "Hello, World!\n " ) ) ;
1306
1308
assert_that ( process ( & p. bin ( "examples/goodbye" ) ) ,
1307
- execs ( ) . with_stdout ( "Goodbye, World!\n " ) ) ;
1309
+ execs ( ) . with_status ( 0 ) . with_stdout ( "Goodbye, World!\n " ) ) ;
1308
1310
}
1309
1311
1310
1312
#[ test]
@@ -1336,9 +1338,9 @@ fn implicit_examples() {
1336
1338
1337
1339
assert_that ( p. cargo_process ( "test" ) , execs ( ) . with_status ( 0 ) ) ;
1338
1340
assert_that ( process ( & p. bin ( "examples/hello" ) ) ,
1339
- execs ( ) . with_stdout ( "Hello, World!\n " ) ) ;
1341
+ execs ( ) . with_status ( 0 ) . with_stdout ( "Hello, World!\n " ) ) ;
1340
1342
assert_that ( process ( & p. bin ( "examples/goodbye" ) ) ,
1341
- execs ( ) . with_stdout ( "Goodbye, World!\n " ) ) ;
1343
+ execs ( ) . with_status ( 0 ) . with_stdout ( "Goodbye, World!\n " ) ) ;
1342
1344
}
1343
1345
1344
1346
#[ test]
@@ -1357,7 +1359,7 @@ fn standard_build_no_ndebug() {
1357
1359
1358
1360
assert_that ( p. cargo_process ( "build" ) , execs ( ) . with_status ( 0 ) ) ;
1359
1361
assert_that ( process ( & p. bin ( "foo" ) ) ,
1360
- execs ( ) . with_stdout ( "slow\n " ) ) ;
1362
+ execs ( ) . with_status ( 0 ) . with_stdout ( "slow\n " ) ) ;
1361
1363
}
1362
1364
1363
1365
#[ test]
@@ -1377,7 +1379,7 @@ fn release_build_ndebug() {
1377
1379
assert_that ( p. cargo_process ( "build" ) . arg ( "--release" ) ,
1378
1380
execs ( ) . with_status ( 0 ) ) ;
1379
1381
assert_that ( process ( & p. release_bin ( "foo" ) ) ,
1380
- execs ( ) . with_stdout ( "fast\n " ) ) ;
1382
+ execs ( ) . with_status ( 0 ) . with_stdout ( "fast\n " ) ) ;
1381
1383
}
1382
1384
1383
1385
#[ test]
@@ -1855,7 +1857,7 @@ fn cargo_platform_specific_dependency_wrong_platform() {
1855
1857
1856
1858
assert_that ( & p. bin ( "foo" ) , existing_file ( ) ) ;
1857
1859
assert_that ( process ( & p. bin ( "foo" ) ) ,
1858
- execs ( ) ) ;
1860
+ execs ( ) . with_status ( 0 ) ) ;
1859
1861
1860
1862
let loc = p. root ( ) . join ( "Cargo.lock" ) ;
1861
1863
let mut lockfile = String :: new ( ) ;
@@ -2249,23 +2251,23 @@ fn build_multiple_packages() {
2249
2251
2250
2252
assert_that ( p. cargo_process ( "build" ) . arg ( "-p" ) . arg ( "d1" ) . arg ( "-p" ) . arg ( "d2" )
2251
2253
. arg ( "-p" ) . arg ( "foo" ) ,
2252
- execs ( ) ) ;
2254
+ execs ( ) . with_status ( 0 ) ) ;
2253
2255
2254
2256
assert_that ( & p. bin ( "foo" ) , existing_file ( ) ) ;
2255
2257
assert_that ( process ( & p. bin ( "foo" ) ) ,
2256
- execs ( ) . with_stdout ( "i am foo\n " ) ) ;
2258
+ execs ( ) . with_status ( 0 ) . with_stdout ( "i am foo\n " ) ) ;
2257
2259
2258
2260
let d1_path = & p. build_dir ( ) . join ( "debug" )
2259
2261
. join ( format ! ( "d1{}" , env:: consts:: EXE_SUFFIX ) ) ;
2260
2262
let d2_path = & p. build_dir ( ) . join ( "debug" )
2261
2263
. join ( format ! ( "d2{}" , env:: consts:: EXE_SUFFIX ) ) ;
2262
2264
2263
2265
assert_that ( d1_path, existing_file ( ) ) ;
2264
- assert_that ( process ( d1_path) , execs ( ) . with_stdout ( "d1" ) ) ;
2266
+ assert_that ( process ( d1_path) , execs ( ) . with_status ( 0 ) . with_stdout ( "d1" ) ) ;
2265
2267
2266
2268
assert_that ( d2_path, existing_file ( ) ) ;
2267
2269
assert_that ( process ( d2_path) ,
2268
- execs ( ) . with_stdout ( "d2" ) ) ;
2270
+ execs ( ) . with_status ( 0 ) . with_stdout ( "d2" ) ) ;
2269
2271
}
2270
2272
2271
2273
#[ test]
@@ -2395,7 +2397,7 @@ fn compiler_json_error_format() {
2395
2397
2396
2398
assert_that ( p. cargo_process ( "build" ) . arg ( "-v" )
2397
2399
. arg ( "--message-format" ) . arg ( "json" ) ,
2398
- execs ( ) . with_json ( r#"
2400
+ execs ( ) . with_status ( 0 ) . with_json ( r#"
2399
2401
{
2400
2402
"reason":"compiler-message",
2401
2403
"package_id":"bar 0.5.0 ([..])",
@@ -2481,7 +2483,7 @@ fn message_format_json_forward_stderr() {
2481
2483
2482
2484
assert_that ( p. cargo_process ( "rustc" ) . arg ( "--bin" ) . arg ( "foo" )
2483
2485
. arg ( "--message-format" ) . arg ( "JSON" ) . arg ( "--" ) . arg ( "-Zno-trans" ) ,
2484
- execs ( )
2486
+ execs ( ) . with_status ( 0 )
2485
2487
. with_stderr_contains ( "[WARNING] the option `Z` is unstable [..]" )
2486
2488
. with_json ( r#"
2487
2489
{
@@ -2584,7 +2586,8 @@ fn build_all_workspace() {
2584
2586
2585
2587
assert_that ( p. cargo_process ( "build" )
2586
2588
. arg ( "--all" ) ,
2587
- execs ( ) . with_stderr ( "[..] Compiling bar v0.1.0 ([..])\n \
2589
+ execs ( ) . with_status ( 0 )
2590
+ . with_stderr ( "[..] Compiling bar v0.1.0 ([..])\n \
2588
2591
[..] Compiling foo v0.1.0 ([..])\n \
2589
2592
[..] Finished debug [unoptimized + debuginfo] target(s) in [..]\n ") ) ;
2590
2593
}
@@ -2617,7 +2620,8 @@ fn build_all_virtual_manifest() {
2617
2620
// The order in which foo and bar are built is not guaranteed
2618
2621
assert_that ( p. cargo_process ( "build" )
2619
2622
. arg ( "--all" ) ,
2620
- execs ( ) . with_stderr_contains ( "[..] Compiling bar v0.1.0 ([..])" )
2623
+ execs ( ) . with_status ( 0 )
2624
+ . with_stderr_contains ( "[..] Compiling bar v0.1.0 ([..])" )
2621
2625
. with_stderr_contains ( "[..] Compiling foo v0.1.0 ([..])" )
2622
2626
. with_stderr ( "[..] Compiling [..] v0.1.0 ([..])\n \
2623
2627
[..] Compiling [..] v0.1.0 ([..])\n \
@@ -2648,7 +2652,8 @@ fn build_all_member_dependency_same_name() {
2648
2652
2649
2653
assert_that ( p. cargo_process ( "build" )
2650
2654
. arg ( "--all" ) ,
2651
- execs ( ) . with_stderr ( "[..] Updating registry `[..]`\n \
2655
+ execs ( ) . with_status ( 0 )
2656
+ . with_stderr ( "[..] Updating registry `[..]`\n \
2652
2657
[..] Downloading a v0.1.0 ([..])\n \
2653
2658
[..] Compiling a v0.1.0\n \
2654
2659
[..] Compiling a v0.1.0 ([..])\n \
0 commit comments