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