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

database: Fix incorrect behavior of toValue when reading empty strings. #46

Merged
merged 1 commit into from
Dec 16, 2015

Conversation

Quentin-M
Copy link
Contributor

If there are two strings for a path (ie. "", "yes"), always return "yes"
and never "".

Unlikely to happen but, still.

@jzelinskie
Copy link
Contributor

I'm not a fan of defensive programming for "what if" scenarios. If something is introducing an empty path, that's a bug, not this code. Is there ever a scenario when the path could be empty and it isn't a bug?

There is apparently no reason to ignore empty results - it was probably the case in the past (`null` value).

["", "v"] should be considered invalid by toValue() because it represents two values.
["", "v"] should be returned as it by toValues(), not trimming "".

Tests passes, it will hopefully not cause any issue in prod.
@Quentin-M
Copy link
Contributor Author

Updated. It basically makes toValues() and toValue() stop ignoring empty strings.

@jzelinskie
Copy link
Contributor

LGTM

Quentin-M pushed a commit that referenced this pull request Dec 16, 2015
database: Fix incorrect behavior of toValue when reading empty strings.
@Quentin-M Quentin-M merged commit 510b901 into master Dec 16, 2015
@Quentin-M Quentin-M deleted the fix_sql_tovalue branch December 16, 2015 20:09
@jzelinskie jzelinskie added area/testing related to improving test coverage reviewed/lgtm labels Mar 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing related to improving test coverage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants