Skip to content

Format single item arrays as an array#2330

Draft
fflaten wants to merge 1 commit into
pester:mainfrom
fflaten:format-singlevaluecollection
Draft

Format single item arrays as an array#2330
fflaten wants to merge 1 commit into
pester:mainfrom
fflaten:format-singlevaluecollection

Conversation

@fflaten

@fflaten fflaten commented Mar 28, 2023

Copy link
Copy Markdown
Collaborator

PR Summary

Single item arrays are currently printed as single item without type-specific formatting because Is-Value expands them. Arrays with a single string or bool (more types?) will not be properly formatted.

# Current
> Format-Nicely @('a')
a

# After
> Format-Nicely @('a')                
@('a')

Related #2329

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten

fflaten commented Mar 28, 2023

Copy link
Copy Markdown
Collaborator Author

Submitting as a draft because I'm not sure if this might format items in an unexpected array somewhere because Pester wraps input internally. The broken test is fixed by #2329

Alternative: Do extra checks inside if(Is-Value ...) { } to call Format-Bool, Format-String etc.

Thoughts @nohwnd ?

@fflaten fflaten force-pushed the format-singlevaluecollection branch from d6b32b2 to e177a7d Compare May 12, 2023 22:11
@nohwnd

nohwnd commented Apr 12, 2024

Copy link
Copy Markdown
Member

I will have a look will need to touch the formatting code for assert as well.

@nohwnd

nohwnd commented Jan 8, 2025

Copy link
Copy Markdown
Member

/backport to rel/5.x.x

@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

Started backporting to rel/5.x.x: https://github.com/pester/Pester/actions/runs/12678365405

@nohwnd

nohwnd commented Jan 8, 2025

Copy link
Copy Markdown
Member

**NOT real backport, ** sorry for spammin' you, testing backporting with new name format so automatic release notes don't have to be completely rewritten.

@nohwnd

nohwnd commented Jan 8, 2025

Copy link
Copy Markdown
Member

/backport to rel/5.x.x

@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

Started backporting to rel/5.x.x: https://github.com/pester/Pester/actions/runs/12678407713

@nohwnd

nohwnd commented Jan 9, 2025

Copy link
Copy Markdown
Member

/backport to rel/5.x.x

@github-actions

github-actions Bot commented Jan 9, 2025

Copy link
Copy Markdown

Started backporting to rel/5.x.x: https://github.com/pester/Pester/actions/runs/12698585823

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.

2 participants