@@ -64,3 +64,39 @@ def test_sdk():
6464 xcodebuild = XcodeBuild (conanfile )
6565 xcodebuild .build ("app.xcodeproj" )
6666 assert "SDKROOT" not in conanfile .command
67+
68+
69+ @pytest .mark .parametrize ("os_name, os_version, expected_key" , [
70+ ("Macos" , "14.0" , "MACOSX_DEPLOYMENT_TARGET" ),
71+ ("iOS" , "15.1" , "IPHONEOS_DEPLOYMENT_TARGET" ),
72+ ("watchOS" , "8.0" , "WATCHOS_DEPLOYMENT_TARGET" ),
73+ ("tvOS" , "15.0" , "TVOS_DEPLOYMENT_TARGET" ),
74+ ("visionOS" , "1.0" , "XROS_DEPLOYMENT_TARGET" )
75+ ])
76+ def test_deployment_target_and_quoting (os_name , os_version , expected_key ):
77+ """
78+ Checks that the correct deployment target is passed and that paths are quoted.
79+ """
80+ conanfile = ConanFileMock ()
81+ conanfile .settings = MockSettings ({"os" : os_name , "os.version" : os_version })
82+ xcodebuild = XcodeBuild (conanfile )
83+
84+ xcodebuild .build ("My Project.xcodeproj" , target = "My Target" )
85+
86+ expected_arg = f" { expected_key } ={ os_version } "
87+ assert expected_arg in conanfile .command
88+
89+ assert "-project 'My Project.xcodeproj'" in conanfile .command
90+ assert "-target 'My Target'" in conanfile .command
91+
92+
93+ def test_no_deployment_target_if_version_is_missing ():
94+ """
95+ Checks that the deployment target argument is not added if os.version is missing.
96+ """
97+ conanfile = ConanFileMock ()
98+ conanfile .settings = MockSettings ({"os" : "Macos" })
99+ xcodebuild = XcodeBuild (conanfile )
100+ xcodebuild .build ("app.xcodeproj" )
101+
102+ assert "MACOSX_DEPLOYMENT_TARGET" not in conanfile .command
0 commit comments