File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -554,3 +554,40 @@ fn build_script_debug_assertions_override_release() {
554554 // Release profile with debug-assertions explicitly enabled
555555 p. cargo ( "check --release" ) . run ( ) ;
556556}
557+
558+ #[ cargo_test]
559+ fn build_script_debug_assertions_build_override ( ) {
560+ let build_rs = r#"
561+ fn main() {
562+ let profile = std::env::var("PROFILE").unwrap();
563+ if profile == "debug" {
564+ assert!(!cfg!(debug_assertions));
565+ } else if profile == "release" {
566+ assert!(cfg!(debug_assertions));
567+ }
568+ }
569+ "# ;
570+
571+ let p = project ( )
572+ . file (
573+ "Cargo.toml" ,
574+ r#"
575+ [package]
576+ name = "foo"
577+ version = "0.1.0"
578+ edition = "2024"
579+
580+ [profile.dev.build-override]
581+ debug-assertions = false
582+
583+ [profile.release.build-override]
584+ debug-assertions = true
585+ "# ,
586+ )
587+ . file ( "src/lib.rs" , r#""# )
588+ . file ( "build.rs" , build_rs)
589+ . build ( ) ;
590+
591+ p. cargo ( "check" ) . run ( ) ;
592+ p. cargo ( "check --release" ) . run ( ) ;
593+ }
You can’t perform that action at this time.
0 commit comments