-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[test] fix for hasPrefix and hasSuffix test #629
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
This bug fix surfaces two cases that always failed, but were masked. |
db795fd
to
2d569b2
Compare
221edf6
to
e98c705
Compare
Rebased after the changes in #1131 |
e98c705
to
b04f46e
Compare
@swift-ci test |
@gribozavr please review |
@tkremenek The swift-ci failure was unrelated to these changes; test again? |
Drive-by test restarting: @swift-ci Please test OS X platform |
@gribozavr This ok to merge? |
@glessard Sorry, I don't understand what this patch changes -- it looks like a pure refactoring to me. I see that you are removing the xfail predicates from the test list, but you're adding them back with the map() function. Why is this making a difference? I'm probably missing something, I would be glad if you could explain to me. |
(edited) In the original version of 'checkHasPrefixHasSuffix', a pair of expected results is calculated, and then are used twice each. This wasn't correct. In particular, if the first character of The fix simply ensures the expected result is recalculated for every single use, by moving the extra suffix and prefix tests to a separate call of |
dd8a3e8
to
b7f6099
Compare
@gribozavr Did the above response clarify the patch? |
b7f6099
to
69cd0c1
Compare
69cd0c1
to
2e26155
Compare
} | ||
|
||
let comparisonTests = [ | ||
let tests = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like anything else in the file is using tests
. Why not just fold the results of the map into the array itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests for comparisons and substrings (prefix and suffix) don't overlap cleanly, so I separated them. The array is also mapped in the commit that follows this one (line 281).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There definitely needs to be a little bit of documentation on both of the maps and on the special cases of the literal here explaining just that. It's hard to see where and why things XFail without it.
@swift-ci please smoke test. |
_ expectedUnicodeCollation: ExpectedComparisonResult, | ||
lhs: String, rhs: String, | ||
xfail: TestRunPredicate, loc: SourceLoc | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this is just a change to a default argument, this initializer isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
2e26155
to
5e0e39c
Compare
I think I'm out of nitpicks if this was pure refactoring. Thank you @glessard. |
Once you've added a bit of docs, please squash this down to a patch or two. |
The expected value should be recalculated for every combination of inputs. It was previously cached and used twice; it appeared to work because of SR-243.
… indicator symbol. Expected failures when testing comparisons and substrings are not the same; separating them allows better coverage.
5e0e39c
to
5a41eaa
Compare
@CodaFi I think this should do it; thanks for the feedback |
@swift-ci please smoke test. |
This issue looks like: going to retrigger the build to see if it picks up the new sha. @swift-ci Please smoke test |
I think we're good to go here. Merging. |
Ah, @gribozavr, did you have any remaining comments? |
LGTM, thanks! |
[pull] swiftwasm from master
[XFail] Xfailed projects failing on linux.
The previous version wrongly cached a result, which in turn masked a bug in the bridged
hasSuffix()
.(reported as https://bugs.swift.org/browse/SR-243)
This version also trips
hasPrefix
, but that involves\u{0}
; the correct behaviour there is less obvious.