[test] Adjust new Substring test#29446
Merged
lorentey merged 2 commits intoswiftlang:masterfrom Jan 27, 2020
Merged
Conversation
We don’t have an easy way to check for the runtime version of the stdlib, so a two-way check for behavioral changes isn’t feasible. (Checking for the OS version isn’t good enough.) Only check for the new behavior, and only when we know for sure that it’s available.
The previous commit made these redundant.
Member
Author
|
Cc @Lukasa |
Member
Author
|
@swift-ci test |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes the new Substring test that checks for the behavioral change introduced in #29094/#29146.
We don't have a good way to test exactly what version of the stdlib we're running on, so it isn't feasible to write two-way tests for behavior that is expected to change between stdlib versions. The
if #available(9999)checks we have now will fail when we run these tests on a future released version of the stdlib that includes these changes. Even worse, the expected behavior on older stdlibs depends on whether the method is called in a Sequence-generic context. (The implementation is marked@_alwaysEmitIntoClient, so client code that directly calls it will have the new behavior; however, the Sequence witness table for Substring will still point to the default implementation in old stdlibs.)Therefore, if the availability test fails, we cannot tell which behavior we need to expect, so we must stop checking for it.
On the other hand, if the availability check succeeds, then we are guaranteed to have a new stdlib -- so we need to look at the expected behavior in that case, and only that case.
rdar://58868606