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

Interpret null as true #397

Merged
merged 2 commits into from
Nov 7, 2020

Conversation

TheConstructor
Copy link
Contributor

@TheConstructor TheConstructor commented Sep 25, 2020

Building towards #334 null should only reach this parser for CommandOptionTypes NoValue or SingleOrNoValue - in both cases true is more likely to be desired.

Building towards natemcmaster#334 null should only reach this parser for CommandOptionTypes NoValue or SingleOrNoValue - in both cases true is more likely to be desired.
@natemcmaster
Copy link
Owner

Should we add a unit test to verify the expected behavior here? It's been a while since I've read this part of the code, so not sure what impact this might have

@TheConstructor
Copy link
Contributor Author

TheConstructor commented Nov 7, 2020

Added some tests. Not 100% happy with bool?, but It kind of makes sense as null is explicitly supported, and it is hard to change as NullableValueParser is auto-applied before the real ValueParser.

Impact basically is just ParsesBoolWithoutOptionalValue. Without the change it would have been false.

Copy link
Owner

@natemcmaster natemcmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding tests. This makes more sense now. Thanks for the contribution!

@natemcmaster natemcmaster merged commit 4f686fe into natemcmaster:main Nov 7, 2020
@natemcmaster natemcmaster added this to the 3.1.0 milestone Nov 7, 2020
@TheConstructor TheConstructor deleted the feature/null-is-true branch April 3, 2021 14:04
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