From f94e3e35dd57367b1963a629a0464fcfa82ae623 Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 21 Nov 2023 20:28:10 +0800 Subject: [PATCH] Fix macOS deployment target test case on Rust 1.74+ (#1861) --- src/build_context.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/build_context.rs b/src/build_context.rs index 7045786e7..9e331603b 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -1268,25 +1268,29 @@ mod test { #[test] fn test_macosx_deployment_target() { + let rustc_ver = rustc_version::version().unwrap(); + let rustc_ver = (rustc_ver.major, rustc_ver.minor); + let x86_64_minor = if rustc_ver >= (1, 74) { 12 } else { 7 }; + let universal2_minor = if rustc_ver >= (1, 74) { 12 } else { 9 }; assert_eq!( macosx_deployment_target(None, false).unwrap(), - ((10, 7), (11, 0)) + ((10, x86_64_minor), (11, 0)) ); assert_eq!( macosx_deployment_target(None, true).unwrap(), - ((10, 9), (11, 0)) + ((10, universal2_minor), (11, 0)) ); assert_eq!( macosx_deployment_target(Some("10.6"), false).unwrap(), - ((10, 7), (11, 0)) + ((10, x86_64_minor), (11, 0)) ); assert_eq!( macosx_deployment_target(Some("10.6"), true).unwrap(), - ((10, 9), (11, 0)) + ((10, universal2_minor), (11, 0)) ); assert_eq!( macosx_deployment_target(Some("10.9"), false).unwrap(), - ((10, 9), (11, 0)) + ((10, universal2_minor), (11, 0)) ); assert_eq!( macosx_deployment_target(Some("11.0.0"), false).unwrap(),