File tree 1 file changed +78
-1
lines changed
1 file changed +78
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use std:: env;
4
4
5
- use cargo_test_support:: project;
5
+ use cargo_test_support:: { is_nightly , project} ;
6
6
7
7
#[ cargo_test]
8
8
fn profile_overrides ( ) {
@@ -471,6 +471,10 @@ fn thin_lto_works() {
471
471
472
472
#[ cargo_test]
473
473
fn strip_works ( ) {
474
+ if !is_nightly ( ) {
475
+ return ;
476
+ }
477
+
474
478
let p = project ( )
475
479
. file (
476
480
"Cargo.toml" ,
@@ -499,3 +503,76 @@ fn strip_works() {
499
503
)
500
504
. run ( ) ;
501
505
}
506
+
507
+ #[ cargo_test]
508
+ fn strip_requires_cargo_feature ( ) {
509
+ if !is_nightly ( ) {
510
+ return ;
511
+ }
512
+
513
+ let p = project ( )
514
+ . file (
515
+ "Cargo.toml" ,
516
+ r#"
517
+ [package]
518
+ name = "foo"
519
+ version = "0.1.0"
520
+
521
+ [profile.release]
522
+ strip = 'symbols'
523
+ "# ,
524
+ )
525
+ . file ( "src/main.rs" , "fn main() {}" )
526
+ . build ( ) ;
527
+
528
+ p. cargo ( "build --release -v" )
529
+ . masquerade_as_nightly_cargo ( )
530
+ . with_status ( 101 )
531
+ . with_stderr (
532
+ "\
533
+ [ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
534
+
535
+ Caused by:
536
+ feature `strip` is required
537
+
538
+ consider adding `cargo-features = [\" strip\" ]` to the manifest
539
+ " ,
540
+ )
541
+ . run ( ) ;
542
+ }
543
+ #[ cargo_test]
544
+ fn strip_rejects_invalid_option ( ) {
545
+ if !is_nightly ( ) {
546
+ return ;
547
+ }
548
+
549
+ let p = project ( )
550
+ . file (
551
+ "Cargo.toml" ,
552
+ r#"
553
+ cargo-features = ["strip"]
554
+
555
+ [package]
556
+ name = "foo"
557
+ version = "0.1.0"
558
+
559
+ [profile.release]
560
+ strip = 'wrong'
561
+ "# ,
562
+ )
563
+ . file ( "src/main.rs" , "fn main() {}" )
564
+ . build ( ) ;
565
+
566
+ p. cargo ( "build --release -v" )
567
+ . masquerade_as_nightly_cargo ( )
568
+ . with_status ( 101 )
569
+ . with_stderr (
570
+ "\
571
+ [ERROR] failed to parse manifest at `[CWD]/Cargo.toml`
572
+
573
+ Caused by:
574
+ unknown variant `wrong`, expected one of `debuginfo`, `none`, `symbols` for key [..]
575
+ " ,
576
+ )
577
+ . run ( ) ;
578
+ }
You can’t perform that action at this time.
0 commit comments