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

Replace IsOriginalValue() with IsModified and fix merging and casting of default option values #2201

Merged
merged 9 commits into from
Jul 25, 2022

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Jun 27, 2022

PR Summary

Only modify configuration options that have actually been changed when casting and merging configurations.

Option.IsOriginalValue() is marked obsolete and is replaced by a new Option.IsModified-property that enables us to fix merging of serialized PesterConfiguration.

Fix #2198

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
Copy link
Collaborator Author

fflaten commented Jun 27, 2022

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@fflaten
Copy link
Collaborator Author

fflaten commented Jun 27, 2022

@nohwnd:

  • Thoughts on this?
  • Any reason to not replace IsOriginalValue() with a getter-only property? That would let us serialize/deserialize it in PesterConfiguration-objects. We could hide it in the formats we generate if necessary. Or keep both method and property (slightly different name) if we believe someone's using the method outside Pester-runtime, which I doubt

@fflaten fflaten changed the title Fix IsOriginalValue when merging and casting default values Fix IsOriginalValue for default options when merging and casting configuration Jun 27, 2022
@nohwnd
Copy link
Member

nohwnd commented Jun 30, 2022

Any reason to not replace IsOriginalValue() with a getter-only property?

I think having it not show up in the output was the only reason.

@fflaten fflaten marked this pull request as ready for review June 30, 2022 16:17
@fflaten
Copy link
Collaborator Author

fflaten commented Jun 30, 2022

Ready for review.
I could change to IsDefaultValue if you'd like to avoid mini-breaking change and keep IsOriginalValue().

@nohwnd
Copy link
Member

nohwnd commented Jul 1, 2022

IsDefaultValue seems like better name. Please put IsOriginalValue() back and mark it deprecated (with Obsolete attribute). Just to be nice about semantic versioning.

@nohwnd
Copy link
Member

nohwnd commented Jul 1, 2022

I don't see it used in open source, but let's still be nice: https://grep.app/search?q=IsOriginalValue%28%29

@fflaten
Copy link
Collaborator Author

fflaten commented Jul 1, 2022

IsDefaultValue seems like better name.

After letting the name sink in, it could confuse someone when it's false while Default and Value are equal (but modified). 😅. Naming is hard. IsModified?

@fflaten fflaten changed the title Fix IsOriginalValue for default options when merging and casting configuration Replace IsOriginalValue() with IsModified and fix merging and casting of default option values Jul 1, 2022
@nohwnd nohwnd merged commit e949115 into pester:main Jul 25, 2022
@fflaten fflaten deleted the fix-isoriginalvalue branch July 25, 2022 09:02
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.

IsOriginalValue() always returns False after merging
2 participants