Add comprehensive scalar type tests for ConvertTo-Json#26736
Merged
daxian-dbw merged 5 commits intoPowerShell:masterPowerShell/PowerShell:masterfrom Feb 5, 2026
yotsuda:add-convertto-json-scalar-tests-v2yotsuda/PowerShell:add-convertto-json-scalar-tests-v2Copy head branch name to clipboard
Merged
Add comprehensive scalar type tests for ConvertTo-Json#26736daxian-dbw merged 5 commits intoPowerShell:masterPowerShell/PowerShell:masterfrom yotsuda:add-convertto-json-scalar-tests-v2yotsuda/PowerShell:add-convertto-json-scalar-tests-v2Copy head branch name to clipboard
daxian-dbw merged 5 commits intoPowerShell:masterPowerShell/PowerShell:masterfrom
yotsuda:add-convertto-json-scalar-tests-v2yotsuda/PowerShell:add-convertto-json-scalar-tests-v2Copy head branch name to clipboard
Conversation
iSazonov
reviewed
Feb 2, 2026
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
iSazonov
reviewed
Feb 2, 2026
Collaborator
iSazonov
left a comment
There was a problem hiding this comment.
Please don't use Match if possible. I believe it is better use BeExactly.
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
Contributor
Author
Summary of All ChangesFrom first review:
From second review:
Test results: 113 passed, 1 failed (pre-existing timezone issue), 1 pending |
Collaborator
|
@yotsuda Thanks! I still see Match is used 9 times in test. Can we replace them with BeExactly? |
iSazonov
reviewed
Feb 2, 2026
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
Address review feedback by replacing all -Match assertions with -BeExactly for more precise test validation. Also add missing $null test case to Primitive scalar types. Changes: - Add $null test case to Primitive scalar types TestCases - Replace -Match with -BeExactly in ETS properties tests (9 instances) - Remove redundant -Not -Match assertion in String ETS test - Calculate timezone offset dynamically for DateTime Local kind test - Use full JSON string comparison for Guid array, Array ETS, and Hashtable ETS tests All tests pass successfully (114 tests). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Author
Changes SummaryI've addressed both review comments: 1. Replaced all
|
iSazonov
reviewed
Feb 3, 2026
test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1
Show resolved
Hide resolved
…-Json.Tests.ps1 Co-authored-by: Ilya <darpa@yandex.ru>
6 tasks
iSazonov
approved these changes
Feb 3, 2026
daxian-dbw
approved these changes
Feb 5, 2026
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.
PR Summary
Add comprehensive scalar type tests for
ConvertTo-Json(Phase 1).PR Context
This is a follow-up to #26639. Per @iSazonov's suggestion, comprehensive tests are being submitted as separate PRs for each phase.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerTests Added
The following scalar type tests are added to
ConvertTo-Json.Tests.ps1:Total: 77 new tests