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

Update availability annotations in tests #213

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

simonjbeaumont
Copy link
Contributor

Checklist

  • I've run tests to see all new and existing tests pass
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

If you've made changes to gyb files

  • I've run .script/generate_boilerplate_files_with_gyb and included updated generated files in a commit of this pull request

Motivation:

When building the tests for iOS and tvOS, the build fails because we are using APIs that aren't available on all platform versions. E.g.:

Tests/CryptoTests/Digests/DigestsTests.swift:117:37: error: 'blockByteCount' is only available in iOS 13.2 or newer
        XCTAssertEqual(Insecure.MD5.blockByteCount, 64)

Modifications:

  • Add @available guard to test that uses blockByteCount API.
  • Update DataProtocol.hexString to not use String.init(unsafeUninitializedCapacity:initializingUTF8With:), which is only available on iOS 14+, and instead use Array.init(unsafeUninitializedCapacity:initializingWith:), which is available on older platforms.

Result:

Tests can now build for and run on iOS and tvOS.

@Lukasa Lukasa added the semver/none No version bump required. label Dec 19, 2023
@Lukasa
Copy link
Collaborator

Lukasa commented Dec 19, 2023

@swift-server-bot add to allowlist

@Lukasa Lukasa enabled auto-merge (squash) December 19, 2023 19:56
@Lukasa Lukasa merged commit 09f7a99 into apple:main Dec 19, 2023
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants