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

Rewrite unified settings test #76591

Merged
merged 45 commits into from
Jan 3, 2025

Conversation

Cosifne
Copy link
Member

@Cosifne Cosifne commented Dec 31, 2024

Previously the test in src/VisualStudio/Core/Test/UnifiedSettings/VisualBasicUnifiedSettingsTests.vb does not cover all the properties (especially, the localization string) in unified settings registration, and we have regressed the strings back in dfc660c#diff-a16de2a58a10f14a7fc8512f47bbd467869339a6135046bb0274d2fce1151f93R1901

This PR revises all the tests using STJ instead of using JSON path to do all the assertion.
Also it modifies a few strings to fit the unified setting model.

It's mainly a test only change.
The only difference in the product is in Unified Settting page:
image

@Cosifne Cosifne requested a review from a team as a code owner December 31, 2024 19:21
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 31, 2024
@@ -449,9 +449,12 @@
<value>In other binary operators: &amp;&amp; || ?? and or</value>
<comment>'and' and 'or' are C# keywords and should not be localized</comment>
</data>
<data name="Show_name_suggestions" xml:space="preserve">
<data name="Show_name_s_uggestions" xml:space="preserve">
Copy link
Member Author

Choose a reason for hiding this comment

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

https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/38111/Guide-for-setting-owners?anchor=titles
See the recommended title here, accelerator key is not needed in unified settings. But in our own legacy page we need that _
Many string changes in this PR is caused by this

</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="CSharpVSResources.resx" GenerateSource="true" />
<EmbeddedResource Update="VSPackage.resx">
<EmbeddedResource Update="VSPackage.resx" GenerateSource="true" Namespace="Microsoft.VisualStudio.LanguageServices.CSharp" >
Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed because in test I need to validate the LOC strings from VSPackage.resx


namespace Roslyn.VisualStudio.Next.UnitTests.UnifiedSettings.TestModel;

internal abstract record UnifiedSettingBase
Copy link
Member Author

Choose a reason for hiding this comment

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

All these classes are just mapping to the csharpSettings.registration.json so it's easier to make assertions to verify the properties.

@@ -198,4 +198,4 @@
[$RootKey$\SettingsManifests\{13c3bbb4-f18f-4111-9f54-a0fb010d9194}]
@="Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage"
"ManifestPath"="$PackageFolder$\UnifiedSettings\csharpSettings.registration.json"
"CacheTag"=qword:3AEFDB0DA1308654
"CacheTag"=qword:18C11F0A543B8AD0
Copy link
Member

Choose a reason for hiding this comment

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

what is this?

Copy link
Member Author

Choose a reason for hiding this comment

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

When you add/modify properties in csharpSettings.registration.json, you need to change this key to make sure the registration file take effect. Also It is useful if you want to deploy and test locally (like devenv /rootsuffix RoslynDev), everytime you change the value, VS would reload the C# page.

The tag value we used is generated by xxHash with the input of csharpSettings.registration.json, so it's also covered by unit test. When someone forget to modify it, test will fail

@Cosifne Cosifne merged commit 692a6cc into dotnet:main Jan 3, 2025
25 checks passed
@Cosifne Cosifne deleted the dev/shech/upgradeUnifiedSettingsTest branch January 3, 2025 22:07
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Needs UX Triage untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants