Skip to content

[test] Add availability guards for tests checking behavioral changes in 5.1 #24496

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

Merged
merged 4 commits into from
May 6, 2019

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented May 4, 2019

Add runtime 9999-availability guards around tests checking for behavioral changes since 5.0.

This is useful in case these tests are deployed with the 5.0 stdlib.

rdar://problem/50150948

@lorentey
Copy link
Member Author

lorentey commented May 4, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented May 4, 2019

Build failed
Swift Test OS X Platform
Git Sha - 4bc496a5935377010c067881a7905cdbbb20a294

@lorentey lorentey force-pushed the stdlib-version-checks-alt branch from 4bc496a to 211aae1 Compare May 4, 2019 02:13
@@ -77,6 +77,8 @@ StringBridgeTests.test("Tagged NSString") {

func returnOne<T>(_ t: T) -> Int { return 1 }
StringBridgeTests.test("Character from NSString") {
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else { return }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -572,6 +572,11 @@ ${Suite}.test("${ArrayType}/init(unsafeUninitializedCapacity:...:)/validCount")
}

${Suite}.test("${ArrayType}/init(unsafeUninitializedCapacity:...:)/reassignBuffer") {
guard #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) else {
// When back-deployed to 5.0, this coding error does not get detected.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's… odd. Did I add that check in something that's now part of the ABI? LGTM in any case, thx @lorentey!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buffer reassign check wasn't in 5.0's underscored initializer, so code using the new public initializer won't get this check when it's deployed on macOS 10.14.2 / iOS 12.2 etc. I don't think this is a problem; the missing check won't break any working code.

Our ABI back deployment tests detected this change in behavior between the 5.0 and 5.1 stdlibs; the availability guard I added here acknowledges that this was an expected change.

@lorentey
Copy link
Member Author

lorentey commented May 4, 2019

@swift-ci test

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants