Repository navigation
test: pin the validators' anchors, the update target's canonicalisation and the uninstall list - #3233
Merged
Merged
Conversation
…on and the uninstall list The winget id, service name and package full name checks anchor with \A and \z, since $ also matches just before a last line break, and no test gave any of them a trailing line break: every newline case had text after it, which the character class refuses under either anchor. Each now has one, and each new case failed with its pattern's anchors changed to ^ and $. ApplyTarget_ResolvesDotSegmentsBeforeDeciding passed with the canonicalisation it is named for deleted. A target whose dot segments climb into the Windows folder, so only its canonical form starts with it, is refused as in a system directory, and with the canonicalisation taken out the new test fails on "does not exist". The uninstall entries the leftover search refuses folders by had no test of their own. ReadAll takes the lists it reads, and is tested over a registry tree written under HKCU\Software\SysManagerTests: the three lists in order, hidden components and updates, a list that cannot be read making the read incomplete and one entry that cannot leaving it whole, and the lists production reads. SystemLeftoverEnvironment takes its read, so a test sees what reaches the search.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests only, plus the two test seams the uninstall-list tests need. Nothing the app does changes, so this releases nothing.
What changes
WingetId.IsValid,WingetId.IsLocalUninstallId,ServiceManagerService's service name check andDebloaterService's package full name check use\A…\z, whose comments say why:$also matches just before a final line break. Every newline case in their tests had text after the break ("pkg\nnewline"), which the character class refuses under either anchor, so reverting any pattern to^…$left the suites green."pkg\n","Git.Git\n","svc\n", a full name ending in\nand local ids ending in\nare added toWingetIdTests,WingetServiceValidationTests,BulkInstallerServiceTests,ServiceManagerServiceTestsandDebloaterServiceTests, and theWingetIdTestscomment that called the mid-string case the\zcase is corrected. App Blocker's name check already has a trailing-newline case.ApplyTarget_ResolvesDotSegments_BeforeTheSystemFolderCheckgivesUpdateApplier.IsValidApplyTargeta target such asC:\Users\..\Windows\System32\SysManager-vX.Y.Z.exe, whose raw form does not start with the Windows folder and whose canonical form does, and expects the system-directory refusal.UninstallEntries.ReadAllgets an overload that takes the lists to read, andUninstallEntriesTestsruns it over a throwawayHKCU\Software\SysManagerTests\…tree: the three lists in order with every value an entry carries,SystemComponentcounting only as a DWORD 1,ParentKeyNameand update release types, a missing list leaving the read whole, a list denied to the current user making it incomplete, one denied entry being skipped with the read still whole, and the lists production reads. The deny rules are real registry ACLs, checked to bite before the read and removed afterwards.SystemLeftoverEnvironmentgets a constructor that takes its read, so a test checks the folders and uninstall commands that reach the search.How it was checked
Each new case was run against its pattern with
\A…\zchanged to^…$and failed, and only the trailing-newline cases did: four cases forIsValid(winget id, upgrade, uninstall, bulk install), both local ids, both service name theories, and the package full name. Withfull = Path.GetFullPath(targetExe)replaced by the raw argument, the new update-target test failed and the old one still passed, which is the gap. For the uninstall list: reporting a denied list as whole, counting anySystemComponentvalue, dropping the user's list, ignoringParentKeyName, and dropping the uninstall command on the way to the search each failed their test. Unit suite twice, the format check, and all four projects built with no warnings.