Skip to content
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

Make fixture verification a bit strict #280

Merged
merged 14 commits into from
Dec 7, 2024

Conversation

sidepelican
Copy link
Collaborator

Currently, in tests, the comparison between the fixture and the actually generated code is done on a word-by-word basis, separated by whitespace.
There might be unnecessary whitespace present in the actually generated code, which is not being detected.

I will make the process slightly more strict and change it to compare on a line-by-line basis.

public private(set) var myStringInBaseSetCallCount = 0
@Published public var myStringInBase: String = "" { didSet { myStringInBaseSetCallCount += 1 } }
@Published public var myStringInBase: String = "" { didSet { myStringInBaseSetCallCount += 1 } }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could find new bug 🤣

@sidepelican sidepelican requested review from fummicc1 and uhooi December 3, 2024 10:11
Copy link
Collaborator

@fummicc1 fummicc1 left a comment

Choose a reason for hiding this comment

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

Thank you so much! LGTM from my side.
This fix improves readability of generated mocks and makes it easy to maintain test code!

class MyProtocolMock: MyProtocol {
private var _anotherParam: Any!
private var _anotherParam: Any!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Improvement of readability🚀

@sidepelican sidepelican merged commit 9fced08 into uber:master Dec 7, 2024
3 checks passed
@sidepelican sidepelican deleted the testvalidation branch December 7, 2024 11:35
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.

2 participants