Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify no spaces between -arch and arm64 #224

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions pylib/gyp/xcode_emulation_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python3

"""Unit tests for the xcode_emulation.py file."""

from gyp.xcode_emulation import XcodeSettings
import sys
import unittest


class TestXcodeSettings(unittest.TestCase):
def setUp(self):
if sys.platform != "darwin":
self.skipTest("This test only runs on macOS")

def test_GetCflags(self):
target = {
"type": "static_library",
"configurations": {
"Release": {},
},
}
configuration_name = "Release"
xcode_settings = XcodeSettings(target)
cflags = xcode_settings.GetCflags(configuration_name, "arm64")

# Do not quote `-arch arm64` with spaces in one string.
self.assertEqual(
cflags,
["-fasm-blocks", "-mpascal-strings", "-Os", "-gdwarf-2", "-arch", "arm64"],
)

def GypToBuildPath(self, path):
return path

def test_GetLdflags(self):
target = {
"type": "static_library",
"configurations": {
"Release": {},
},
}
configuration_name = "Release"
xcode_settings = XcodeSettings(target)
ldflags = xcode_settings.GetLdflags(
configuration_name, "PRODUCT_DIR", self.GypToBuildPath, "arm64"
)

# Do not quote `-arch arm64` with spaces in one string.
self.assertEqual(ldflags, ["-arch", "arm64", "-LPRODUCT_DIR"])


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers = [
]

[project.optional-dependencies]
dev = ["flake8", "ruff", "pytest"]
dev = ["flake8", "ruff == 0.3.0", "pytest"]

[project.scripts]
gyp = "gyp:script_main"
Expand Down
Loading