File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -471,3 +471,22 @@ fn build_script_debug_assertions_dev() {
471471 // Default dev profile has debug-assertions enabled
472472 p. cargo ( "check" ) . run ( ) ;
473473}
474+
475+ #[ cargo_test]
476+ fn build_script_debug_assertions_release ( ) {
477+ // Test that CARGO_CFG_DEBUG_ASSERTIONS is NOT set in release profile (default)
478+ let build_rs = r#"
479+ fn main() {
480+ let has_debug_assertions = std::env::var_os("CARGO_CFG_DEBUG_ASSERTIONS").is_some();
481+ assert!(!has_debug_assertions, "CARGO_CFG_DEBUG_ASSERTIONS should NOT be set in release profile");
482+ }
483+ "# ;
484+
485+ let p = project ( )
486+ . file ( "src/lib.rs" , r#""# )
487+ . file ( "build.rs" , build_rs)
488+ . build ( ) ;
489+
490+ // Release profile has debug-assertions disabled by default
491+ p. cargo ( "check --release" ) . run ( ) ;
492+ }
You can’t perform that action at this time.
0 commit comments