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

[Rgen] Create a generic method that can be used to test all attr parsing. #22073

Open
wants to merge 12 commits into
base: dev/mandel/readonly-records
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

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.

mandel-macaque and others added 12 commits January 26, 2025 17:37
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.
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

❗ API diff vs stable (Breaking changes)

.NET ( ❗ Breaking changes ❗ )

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [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
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 1538ad02f4ac2b90eac139c981f54e89a2dd34b8 [PR build]

@mandel-macaque mandel-macaque force-pushed the dev/mandel/readonly-records branch from 055ff95 to 7c02d97 Compare January 30, 2025 13:30
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.

3 participants