-
Notifications
You must be signed in to change notification settings - Fork 249
Fix more postfix pound if scenarios #402
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
Changes from 1 commit
4cad9a8
fdc708f
1361dd5
d7b390f
4fd796f
3172157
dea0d25
79b9d3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -390,4 +390,68 @@ final class IfConfigTests: PrettyPrintTestCase { | |
|
||
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45) | ||
} | ||
|
||
func testPostfixPoundIfBetweenOtherModifiers() { | ||
let input = | ||
""" | ||
EmptyView() | ||
.padding([.vertical]) | ||
#if os(iOS) | ||
.iOSSpecificModifier() | ||
#endif | ||
.commonModifier() | ||
""" | ||
|
||
let expected = | ||
""" | ||
EmptyView() | ||
.padding([.vertical]) | ||
#if os(iOS) | ||
.iOSSpecificModifier() | ||
#endif | ||
.commonModifier() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not handled properly by these changes because I didn't think to try adding this until I was creating this pull request. Will look into how to solve this but wanted to have it in this pull request so I didn't forget to mention it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you had any luck with this one? For consistency we'd definitely like if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have not yet, things at work got really busy soon after I created this. I'll take another look at it soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took me a bit longer than I expected to get back to this. I think this latest commit works as intended. Let me know if I misunderstood. I don't love the implementation I landed on so I'l be looking to improve it if I can. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happier where this is now. Would appreciate any and all feedback :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @allevato Friendly ping for awareness, not urgency, here since it took me so long to get back to this. I think it is behaving how you described now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay; I lost track of this one. These results look great, thanks for getting all these cases working so well! |
||
|
||
""" | ||
|
||
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45) | ||
} | ||
|
||
func testPostfixPoundIfWithTypeInModifier() { | ||
let input = | ||
""" | ||
EmptyView() | ||
.padding([.vertical]) | ||
#if os(iOS) | ||
.iOSSpecificModifier( | ||
SpecificType() | ||
.onChanged { _ in | ||
// do things | ||
} | ||
.onEnded { _ in | ||
// do things | ||
} | ||
) | ||
#endif | ||
""" | ||
|
||
let expected = | ||
""" | ||
EmptyView() | ||
.padding([.vertical]) | ||
#if os(iOS) | ||
.iOSSpecificModifier( | ||
SpecificType() | ||
.onChanged { _ in | ||
// do things | ||
} | ||
.onEnded { _ in | ||
// do things | ||
} | ||
) | ||
#endif | ||
|
||
""" | ||
|
||
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45) | ||
} | ||
} |
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.
This handles the scenario in this test
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the fragile part which I dislike. It handles the scenario in that test fine, but what other scenarios are there that this does not handle, or that this breaks?