-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Test and Fix: subset and superset for empty character set #6000
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
Conversation
While the Set has a test for empty set being subset of any other set at https://github.com/apple/swift/blob/e941da319598e71de5169fcd2cc625bd7600fb94/validation-test/stdlib/Set.swift#L2724 , Character Set does not have that test. Also on Swift 3.0 and Swift 3.0.1, this code crashes during execution: ``` import Foundation CharacterSet( charactersIn:"abc" ).isSuperset(of: "") ``` without any failing tests; So this test fails if bug persists.
This Fixes that this code crashes during running: ``` import Foundation CharacterSet( charactersIn:"abc" ).isSuperset(of: "") ```
add test to assure runtime result of empty set is subset of itself and superset of itself. currently running on swift 3.0 returns false instead of expected true in the following code: ``` import Foundation CharacterSet().isSuperset(of: CharacterSet()) ```
@swift-ci Please smoke test |
Good catch. Can you add tests for the two false comparisons? ( |
Thank you for your kind words. |
@swift-ci Please smoke test |
I'm not sure this is the right fix. Why would just this one API be broken? cc @phausler |
I would guess this is not the only one broken here; most likely there are other cases that will fail too - my guess is actually it has to do with the secondary character set being passed across. So |
The new test is also failing (runtime segfault) on the resilience bot. Did it uncover a resilience bug? |
New test also segfaulted on watchOS simulator. I assume we have unresolved CharacterSet bugs somewhere. I'll revert this change and file bug reports for now. |
Filed rdar://29474937 for the test segfault. We'll revisit this once the bug is fixed. |
Filed https://bugs.swift.org/browse/SR-3311 for the incorrect empty set behavior that this change was trying to fix. @jrose-apple and @phausler, if you suspect other empty set problems then please follow up there. |
I added tests for the resilience bug, so as to force the bug to appear in every testing causing runtime error. I also added tests for 3 other functions : isStrictSubset() and isStrictSuperset() and equality operator . Current file is at : https://github.com/MuhammadAnnaqeeb/swift/blob/master/test/stdlib/TestCharacterSet.swift Please reopen this Pull Request just for enough period to run tests. I only want to see if the tests would now constantly fails. |
I don't think we can re-open a PR that was merged and then reverted. Can you make a new one? |
OK, I will open another PR. |
1- add tests for subset and superset for empty character set
2- fix runtime crash of
3- fix return value of
expected value is true, currently returned value is false