forked from ChargePoint/xcparse
-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Xcode 26 beta 2 version detection failure #2
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
Open
davidbean-hash
wants to merge
3
commits into
master
Choose a base branch
from
devin/1779287516-fix-xcode26-version-detection
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
37800b9
Fix Xcode 26 beta 2 version detection failure
devin-ai-integration[bot] 02a6587
Add unit tests for version parsing and refactor for testability
devin-ai-integration[bot] dc3fc12
Fix version scheme transition: handle semantic versioning for Xcode 16+
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| // | ||
| // VersionParsingTests.swift | ||
| // xcparseTests | ||
| // | ||
| // Tests for Version+XCPTooling.swift parsing logic | ||
| // | ||
|
|
||
| import XCTest | ||
| import TSCUtility | ||
| @testable import XCParseCore | ||
|
|
||
| final class VersionParsingTests: XCTestCase { | ||
|
|
||
| // MARK: - Plain integer version (pre-Xcode 26 format) | ||
|
|
||
| func testPlainIntegerVersion() { | ||
| let output = "xcresulttool version 23028, format version 3.53 (current)\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(23028, 0, 0)) | ||
| } | ||
|
|
||
| func testPlainIntegerVersionWithoutTrailingInfo() { | ||
| let output = "xcresulttool version 23028\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(23028, 0, 0)) | ||
| } | ||
|
|
||
| // MARK: - Dotted version (Xcode 26 beta format) | ||
|
|
||
| func testDottedVersionTwoComponents() { | ||
| let output = "xcresulttool version 26.0, format version 3.53 (current)\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 0, 0)) | ||
| } | ||
|
|
||
| func testDottedVersionThreeComponents() { | ||
| let output = "xcresulttool version 26.0.0, format version 3.53 (current)\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 0, 0)) | ||
| } | ||
|
|
||
| func testDottedVersionWithNonZeroPatch() { | ||
| let output = "xcresulttool version 26.1.2, format version 3.53 (current)\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 1, 2)) | ||
| } | ||
|
|
||
| func testDottedVersionWithNonZeroMinor() { | ||
| let output = "xcresulttool version 26.3\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 3, 0)) | ||
| } | ||
|
|
||
| // MARK: - Unparseable output | ||
|
|
||
| func testEmptyStringReturnsNil() { | ||
| let output = "" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNil(version) | ||
| } | ||
|
|
||
| func testGarbageOutputReturnsNil() { | ||
| let output = "some completely unrelated output\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNil(version) | ||
| } | ||
|
|
||
| func testNoVersionNumberReturnsNil() { | ||
| let output = "xcresulttool version abc\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNil(version) | ||
| } | ||
|
|
||
| // MARK: - Fallback regex parsing | ||
|
|
||
| func testFallbackRegexWithDifferentPrefix() { | ||
| let output = "Tool version 23028\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(23028, 0, 0)) | ||
| } | ||
|
|
||
| func testFallbackRegexWithDottedVersion() { | ||
| let output = "Tool version 26.0.1\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 0, 1)) | ||
| } | ||
|
|
||
| // MARK: - Version scheme detection | ||
|
|
||
| func testSemanticVersioningDetected() { | ||
| XCTAssertTrue(Version.usesSemanticVersioning(Version(26, 0, 0))) | ||
| XCTAssertTrue(Version.usesSemanticVersioning(Version(16, 0, 0))) | ||
| XCTAssertFalse(Version.usesSemanticVersioning(Version(15500, 0, 0))) | ||
| XCTAssertFalse(Version.usesSemanticVersioning(Version(23028, 0, 0))) | ||
| } | ||
|
|
||
| // MARK: - needsLegacyFlag behavior | ||
|
|
||
| func testOldSchemeAboveThresholdNeedsLegacy() { | ||
| XCTAssertTrue(Version.needsLegacyFlag(Version(23028, 0, 0))) | ||
| } | ||
|
|
||
| func testOldSchemeBelowThresholdDoesNotNeedLegacy() { | ||
| XCTAssertFalse(Version.needsLegacyFlag(Version(15500, 0, 0))) | ||
| } | ||
|
|
||
| func testXcode26NeedsLegacy() { | ||
| // Xcode 26 uses new scheme — always needs legacy flag | ||
| XCTAssertTrue(Version.needsLegacyFlag(Version(26, 0, 0))) | ||
| } | ||
|
|
||
| // MARK: - supportsUnicodeExportPaths behavior | ||
|
|
||
| func testOldSchemeAboveThresholdSupportsUnicode() { | ||
| XCTAssertTrue(Version.supportsUnicodeExportPaths(Version(15500, 0, 0))) | ||
| } | ||
|
|
||
| func testOldSchemeBelowThresholdDoesNotSupportUnicode() { | ||
| XCTAssertFalse(Version.supportsUnicodeExportPaths(Version(10000, 0, 0))) | ||
| } | ||
|
|
||
| func testXcode26SupportsUnicode() { | ||
| // Xcode 26 uses new scheme — always supports Unicode | ||
| XCTAssertTrue(Version.supportsUnicodeExportPaths(Version(26, 0, 0))) | ||
| } | ||
|
|
||
| // MARK: - Edge cases | ||
|
|
||
| func testMultilineOutputWithVersionOnSecondLine() { | ||
| let output = "some header info\nxcresulttool version 23028, format version 3.53\n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(23028, 0, 0)) | ||
| } | ||
|
|
||
| func testOutputWithExtraWhitespace() { | ||
| let output = " xcresulttool version 23028 \n" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(23028, 0, 0)) | ||
| } | ||
|
|
||
| func testOutputWithCommasSeparatingComponents() { | ||
| let output = "xcresulttool version 26.0, format version 3.53 (current)" | ||
| let version = Version.parseXcresulttoolVersionOutput(output) | ||
| XCTAssertNotNil(version) | ||
| XCTAssertEqual(version, Version(26, 0, 0)) | ||
| } | ||
|
|
||
| static var allTests = [ | ||
| ("testPlainIntegerVersion", testPlainIntegerVersion), | ||
| ("testPlainIntegerVersionWithoutTrailingInfo", testPlainIntegerVersionWithoutTrailingInfo), | ||
| ("testDottedVersionTwoComponents", testDottedVersionTwoComponents), | ||
| ("testDottedVersionThreeComponents", testDottedVersionThreeComponents), | ||
| ("testDottedVersionWithNonZeroPatch", testDottedVersionWithNonZeroPatch), | ||
| ("testDottedVersionWithNonZeroMinor", testDottedVersionWithNonZeroMinor), | ||
| ("testEmptyStringReturnsNil", testEmptyStringReturnsNil), | ||
| ("testGarbageOutputReturnsNil", testGarbageOutputReturnsNil), | ||
| ("testNoVersionNumberReturnsNil", testNoVersionNumberReturnsNil), | ||
| ("testFallbackRegexWithDifferentPrefix", testFallbackRegexWithDifferentPrefix), | ||
| ("testFallbackRegexWithDottedVersion", testFallbackRegexWithDottedVersion), | ||
| ("testSemanticVersioningDetected", testSemanticVersioningDetected), | ||
| ("testOldSchemeAboveThresholdNeedsLegacy", testOldSchemeAboveThresholdNeedsLegacy), | ||
| ("testOldSchemeBelowThresholdDoesNotNeedLegacy", testOldSchemeBelowThresholdDoesNotNeedLegacy), | ||
| ("testXcode26NeedsLegacy", testXcode26NeedsLegacy), | ||
| ("testOldSchemeAboveThresholdSupportsUnicode", testOldSchemeAboveThresholdSupportsUnicode), | ||
| ("testOldSchemeBelowThresholdDoesNotSupportUnicode", testOldSchemeBelowThresholdDoesNotSupportUnicode), | ||
| ("testXcode26SupportsUnicode", testXcode26SupportsUnicode), | ||
| ("testMultilineOutputWithVersionOnSecondLine", testMultilineOutputWithVersionOnSecondLine), | ||
| ("testOutputWithExtraWhitespace", testOutputWithExtraWhitespace), | ||
| ("testOutputWithCommasSeparatingComponents", testOutputWithCommasSeparatingComponents), | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.