-
Notifications
You must be signed in to change notification settings - Fork 518
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
[Rgen] Create a generic method that can be used to test all attr parsing. #22073
base: dev/mandel/readonly-records
Are you sure you want to change the base?
[Rgen] Create a generic method that can be used to test all attr parsing. #22073
Conversation
Add new code that will generate a 2 methods for each BindingAttribute marked AttributeName. A method that will allow to check if the attribute data is present and a method that allows to retrieve the data. The new generated code will look liek this https://gist.github.com/mandel-macaque/7ffb4b215cb5856d91fd391393564170
This change adds two more properties to the data models when they are compile. One to check if the data attr is present, and a second one with the attribute details. The boolean property is decorated acordingly to help with the nullability analisys. An example of the generated code can be found here: https://gist.github.com/mandel-macaque/04185ea481ca30ef9ff2ecf6dbf51ea0
We cannot use an or a & we need to provide a list, that leater is tested against a flag that has been either | or &.
Allow the transformer to detect this. We will need to think a way to port them to the new API style.
There is a reason we landed the code first as a struct, later as a readonly record struct. In the first pass, we added the manual code, had full control and were sure the method did what we exepcted. In the second pass we remove all the manual code EXCEPT that code that should be manual. We knew what to change becuase the tests failed with the code generated by the compiler. The only method that the compiler generates that is not quite correct is the Equals for the BaseTypeAttribute that has to be written by hand. Tests verify that the behaviour is the same as that one of the manual code.
…ing. The tests for the attr parsing for all attrs are very similar, we can create a generic test that can be reused by all and that way mantain less code and be faster when adding a new test.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [PR Build] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
✅ API diff for current PR / commit.NET ( No breaking changes )❗ API diff vs stable (Breaking changes).NET ( ❗ Breaking changes ❗ )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 112 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
055ff95
to
7c02d97
Compare
The tests for the attr parsing for all attrs are very similar, we can create a generic test that can be reused by all and that way mantain less code and be faster when adding a new test.