Repository navigation
Cmdlet-binding tests, second slice (#173), plus two cmdlet fixes - #233
Merged
Merged
Conversation
…flags Format-VisioPage -Width and -Height always threw a COMException: PageCommands.SetFormatCells committed the page format cells to the Page object instead of its page sheet (SetPageSize already used the page sheet). New-VisioHyperlink accepted -NewWindow, -Default, -Invisible and -SortKey and ignored them: HyperlinkHelper.Add left those cells commented out, so they always stayed FALSE or unset. It now writes them to the shape sheet (the sort key quoted so it is a valid formula). Found by the second slice of cmdlet-binding tests (#173). Each fix has tests that fail without it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
46 new tests in VTest.PowerShell covering parameter-set resolution, mandatory parameters, switches, enums and pipeline binding for Get-VisioPage, Get-VisioShape, Get-VisioDocument, Select-VisioShape, New-VisioPage, Format-VisioPage, Remove-VisioPage, Format-VisioShape, New-VisioHyperlink, Set-VisioCustomProperty, Connect-VisioShape, Format-VisioWindow and the type-driven parameter sets of Out-VisioApplication. Adds CmdletScriptExtensions (RunInNewDocument, ExpectFailureInNewDocument, MessageOf) so each test runs one script in the runspace and returns plain values. Updates the test counts, the TESTING.md harness notes, the coverage gap list and CLAUDE.md. Get-VisioPage -ID's index-vs-ID question is filed as #232 and deliberately not asserted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
Second slice of cmdlet-binding tests (#173), plus the two bugs they found.
Tests (VTest.PowerShell, 27 -> 73)
46 new tests that run scripts through the session's runspace, so PowerShell's binder resolves parameter sets, positions, mandatory parameters, switches and enums:
PageCmdletBindingTests:Get-VisioPage,New-VisioPage,Format-VisioPage,Remove-VisioPage.ShapeCmdletBindingTests:Get-VisioShape,Select-VisioShape,Format-VisioShape,New-VisioHyperlink,Set-VisioCustomProperty,Connect-VisioShape(mandatory parameters only).DocumentWindowCmdletBindingTests:Get-VisioDocument,Format-VisioWindow, and the type-driven parameter sets ofOut-VisioApplication.CmdletScriptExtensions(RunInNewDocument,ExpectFailureInNewDocument,MessageOf) so each test builds everything in one script and returns plain values.Bugs found and fixed
Format-VisioPage -Width/-Heightalways threw aCOMException.PageCommands.SetFormatCellscommitted the page format cells to thePageobject instead of its page sheet (SetPageSizealready used the page sheet).New-VisioHyperlink -NewWindow,-Default,-Invisibleand-SortKeywere accepted and ignored.HyperlinkHelper.Addhad that code commented out, so the cells always stayedFALSE/unset. It now writes them to the shape sheet (sort key quoted so it is a valid formula).I ran the four tests for these against the code without the fixes: all four failed. With the fixes they pass.
Deliberately not asserted
Get-VisioPage -IDuses the page index, not the page ID (#232). That is a decision for the maintainer, so no test pins either behavior.Testing
Debug build, local Visio: VTest.PowerShell 73/73, VTest.Models 104/104, VTest.Scripting 43/43 (VTest, 108 tests, not touched).
Also
NuGet/CHANGELOG.mdandVisioPowerShell/CHANGELOG.md[Unreleased]: Fixed entries.docs/TESTING.md(counts and the new harness helpers),docs/futures/test-coverage-gaps.mdandCLAUDE.mdupdated.This PR also exercises the new
masterbranch rule: auto-merge is enabled and should wait for Build (Debug) and Build (Release).Refs #173, #232
🤖 Generated with Claude Code